import delimited "C:\Users\jgraeber\OneDrive - High Point University\Articles\Explaining Citizenship Policy\Dataset-BJPS-112119.csv", case(preserve)
cd "C:\Users\jgraeber\OneDrive - High Point University\Articles\Explaining Citizenship Policy\Final Manuscript Tables for Submission"

xtset CountryCode Year

///Label CountryCode with Country Name Labels
label define Countries 1 "Austria" 2 "Belgium" 3 "Denmark" 4 "Finland" 5 "France" 6 "Germany" 7 "Greece" 8 "Ireland" 9 "Italy" 10 "Luxembourg" 11 "Netherlands" 12 "Norway" 13 "Portugal" 14 "Spain" 15 "Sweden" 16 "United Kingdom" 
label values CountryCode Countries

///Right and Left Government Dummy Variables
gen RightGov = 0 if !missing(LRScore3)
replace RightGov = 1 if LRScore3 ==3
gen LeftGov = 0 if !missing(LRScore3)
replace LeftGov = 1 if LRScore3 ==1

///Liberal Government Dummy
gen LibGov = 0
replace LibGov = 1 if strpos(CoalitionType, "Lib") > 0
replace LibGov = 1 if strpos(CoalitionType, "lib") > 0
lab define LibGovTypes 1 "Liberal Party in Gov't" 0 "No Liberal Party in Gov't"
lab values LibGov LibGovTypes 

/// Citizenship policy change - normalized version 13 (magnitude of change)
bysort CountryCode (Year): gen TotalPassNorm13Diff = TotalPassNorm13 - TotalPassNorm13[_n-1]

/// Citizenship policy change - normalized version 13 (counts of changes)
/// Linguistic
bysort CountryCode (Year): gen LingPassNorm13Change = 0 if !missing(LingPassNorm13)
bysort CountryCode (Year): replace LingPassNorm13Change = 1 if (LingPassNorm13 > LingPassNorm13[_n-1] & !missing(LingPassNorm13[_n-1]))
bysort CountryCode (Year): replace LingPassNorm13Change = -1 if (LingPassNorm13 < LingPassNorm13[_n-1] & !missing(LingPassNorm13[_n-1]))
gen LingPassNorm13Lib = 0
replace LingPassNorm13Lib = 1 if LingPassNorm13Change == -1
gen LingPassNorm13Res = 0
replace LingPassNorm13Res = 1 if LingPassNorm13Change == 1
/// Econ
bysort CountryCode (Year): gen EconPassNorm13Change = 0 if !missing(EconPassNorm13)
bysort CountryCode (Year): replace EconPassNorm13Change = 1 if (EconPassNorm13 > EconPassNorm13[_n-1] & !missing(EconPassNorm13[_n-1]))
bysort CountryCode (Year): replace EconPassNorm13Change = -1 if (EconPassNorm13 < EconPassNorm13[_n-1] & !missing(EconPassNorm13[_n-1]))
gen EconPassNorm13Lib = 0
replace EconPassNorm13Lib = 1 if EconPassNorm13Change == -1
gen EconPassNorm13Res = 0
replace EconPassNorm13Res = 1 if EconPassNorm13Change == 1
/// Civic
bysort CountryCode (Year): gen CivicPassNorm13Change = 0 if !missing(CivicPassNorm13)
bysort CountryCode (Year): replace CivicPassNorm13Change = 1 if (CivicPassNorm13 > CivicPassNorm13[_n-1] & !missing(CivicPassNorm13[_n-1]))
bysort CountryCode (Year): replace CivicPassNorm13Change = -1 if (CivicPassNorm13 < CivicPassNorm13[_n-1] & !missing(CivicPassNorm13[_n-1]))
gen CivicPassNorm13Lib = 0
replace CivicPassNorm13Lib = 1 if CivicPassNorm13Change == -1
gen CivicPassNorm13Res = 0
replace CivicPassNorm13Res = 1 if CivicPassNorm13Change == 1
/// Dual
bysort CountryCode (Year): gen DualPassNorm13Change = 0 if !missing(DualPassNorm13)
bysort CountryCode (Year): replace DualPassNorm13Change = 1 if (DualPassNorm13 > DualPassNorm13[_n-1] & !missing(DualPassNorm13[_n-1]))
bysort CountryCode (Year): replace DualPassNorm13Change = -1 if (DualPassNorm13 < DualPassNorm13[_n-1] & !missing(DualPassNorm13[_n-1]))
gen DualPassNorm13Lib = 0
replace DualPassNorm13Lib = 1 if DualPassNorm13Change == -1
gen DualPassNorm13Res = 0
replace DualPassNorm13Res = 1 if DualPassNorm13Change == 1
/// Years
bysort CountryCode (Year): gen YearsPassNorm13Change = 0 if !missing(YearsPassNorm13)
bysort CountryCode (Year): replace YearsPassNorm13Change = 1 if (YearsPassNorm13 > YearsPassNorm13[_n-1] & !missing(YearsPassNorm13[_n-1]))
bysort CountryCode (Year): replace YearsPassNorm13Change = -1 if (YearsPassNorm13 < YearsPassNorm13[_n-1] & !missing(YearsPassNorm13[_n-1]))
gen YearsPassNorm13Lib = 0
replace YearsPassNorm13Lib = 1 if YearsPassNorm13Change == -1
gen YearsPassNorm13Res = 0
replace YearsPassNorm13Res = 1 if YearsPassNorm13Change == 1
/// Jus
bysort CountryCode (Year): gen JusPassNorm13Change = 0 if !missing(JusPassNorm13)
bysort CountryCode (Year): replace JusPassNorm13Change = 1 if (JusPassNorm13 > JusPassNorm13[_n-1] & !missing(JusPassNorm13[_n-1]))
bysort CountryCode (Year): replace JusPassNorm13Change = -1 if (JusPassNorm13 < JusPassNorm13[_n-1] & !missing(JusPassNorm13[_n-1]))
gen JusPassNorm13Lib = 0
replace JusPassNorm13Lib = 1 if JusPassNorm13Change == -1
gen JusPassNorm13Res = 0
replace JusPassNorm13Res = 1 if JusPassNorm13Change == 1
/// Legal
bysort CountryCode (Year): gen LegalPassNorm13Change = 0 if !missing(LegalPassNorm13)
bysort CountryCode (Year): replace LegalPassNorm13Change = 1 if (LegalPassNorm13 > LegalPassNorm13[_n-1] & !missing(LegalPassNorm13[_n-1]))
bysort CountryCode (Year): replace LegalPassNorm13Change = -1 if (LegalPassNorm13 < LegalPassNorm13[_n-1] & !missing(LegalPassNorm13[_n-1]))
gen LegalPassNorm13Lib = 0
replace LegalPassNorm13Lib = 1 if LegalPassNorm13Change == -1
gen LegalPassNorm13Res = 0
replace LegalPassNorm13Res = 1 if LegalPassNorm13Change == 1
/// Fam
bysort CountryCode (Year): gen FamPassNorm13Change = 0 if !missing(FamPassNorm13)
bysort CountryCode (Year): replace FamPassNorm13Change = 1 if (FamPassNorm13 > FamPassNorm13[_n-1] & !missing(FamPassNorm13[_n-1]))
bysort CountryCode (Year): replace FamPassNorm13Change = -1 if (FamPassNorm13 < FamPassNorm13[_n-1] & !missing(FamPassNorm13[_n-1]))
gen FamPassNorm13Lib = 0
replace FamPassNorm13Lib = 1 if FamPassNorm13Change == -1
gen FamPassNorm13Res = 0
replace FamPassNorm13Res = 1 if FamPassNorm13Change == 1
/// Ethnic
bysort CountryCode (Year): gen EthnicPassNorm13Change = 0 if !missing(EthnicPassNorm13)
bysort CountryCode (Year): replace EthnicPassNorm13Change = 1 if (EthnicPassNorm13 > EthnicPassNorm13[_n-1] & !missing(EthnicPassNorm13[_n-1]))
bysort CountryCode (Year): replace EthnicPassNorm13Change = -1 if (EthnicPassNorm13 < EthnicPassNorm13[_n-1] & !missing(EthnicPassNorm13[_n-1]))
gen EthnicPassNorm13Lib = 0
replace EthnicPassNorm13Lib = 1 if EthnicPassNorm13Change == -1
gen EthnicPassNorm13Res = 0
replace EthnicPassNorm13Res = 1 if EthnicPassNorm13Change == 1
// Total Count Changes
bysort CountryCode (Year): gen TotalPassNorm13Changes = 0
bysort CountryCode (Year): replace TotalPassNorm13Changes = LingPassNorm13Change + EconPassNorm13Change + CivicPassNorm13Change + DualPassNorm13Change + YearsPassNorm13Change + JusPassNorm13Change + LegalPassNorm13Change + FamPassNorm13Change + EthnicPassNorm13Change 

// Total Count Liberalizations and Restrictions
gen TotalPassNorm13LibCount = LingPassNorm13Lib + EconPassNorm13Lib + CivicPassNorm13Lib + DualPassNorm13Lib + YearsPassNorm13Lib + JusPassNorm13Lib + LegalPassNorm13Lib + FamPassNorm13Lib + EthnicPassNorm13Lib 
gen TotalPassNorm13ResCount = LingPassNorm13Res + EconPassNorm13Res + CivicPassNorm13Res + DualPassNorm13Res + YearsPassNorm13Res + JusPassNorm13Res + LegalPassNorm13Res + FamPassNorm13Res + EthnicPassNorm13Res 
tab TotalPassNorm13LibCount
tab TotalPassNorm13ResCount

/// Citizenship policy change - normalized version 13 with weights for Jus, dual, spousal categories
bysort CountryCode (Year): gen DoubleDualPassNorm13 = DualPassNorm13*2
bysort CountryCode (Year): gen DoubleJusPassNorm13 = JusPassNorm13*2
bysort CountryCode (Year): gen DoubleFamPassNorm13 = FamPassNorm13*2
bysort CountryCode (Year): gen TotalPassNorm13weighted = LingPassNorm13 + EconPassNorm13 + CivicPassNorm13 + DoubleDualPassNorm13 + YearsPassNorm13 + DoubleJusPassNorm13 + LegalPassNorm13 + DoubleFamPassNorm13 + EthnicPassNorm13 
bysort CountryCode (Year): gen TotalPassNorm13weightedDiff = TotalPassNorm13weighted - TotalPassNorm13weighted[_n-1]

/// Dummy Variables for Any Liberalization or Any Restriction
bysort CountryCode (Year): gen PassAnyLibDummy13 = 0
replace PassAnyLibDummy13 = 1 if TotalPassNorm13Diff < 0
lab var PassAnyLibDummy13 "Any Liberalization"
bysort CountryCode (Year): gen PassAnyResDummy13 = 0
replace PassAnyResDummy13 = 1 if TotalPassNorm13Diff > 0
lab var PassAnyResDummy13 "Any Restriction"

/// Dummy Count Variables for Any Liberalization or Any Restriction
bysort CountryCode (Year): gen PassAnyLibCountDummy13 = 0
replace PassAnyLibCountDummy13 = 1 if LingPassNorm13Change == -1
replace PassAnyLibCountDummy13 = 1 if EconPassNorm13Change == -1
replace PassAnyLibCountDummy13 = 1 if CivicPassNorm13Change == -1
replace PassAnyLibCountDummy13 = 1 if DualPassNorm13Change == -1
replace PassAnyLibCountDummy13 = 1 if YearsPassNorm13Change == -1
replace PassAnyLibCountDummy13 = 1 if JusPassNorm13Change == -1
replace PassAnyLibCountDummy13 = 1 if LegalPassNorm13Change == -1
replace PassAnyLibCountDummy13 = 1 if FamPassNorm13Change == -1
replace PassAnyLibCountDummy13 = 1 if EthnicPassNorm13Change == -1
bysort CountryCode (Year): gen PassAnyResCountDummy13 = 0
replace PassAnyResCountDummy13 = 1 if LingPassNorm13Change == 1
replace PassAnyResCountDummy13 = 1 if EconPassNorm13Change == 1
replace PassAnyResCountDummy13 = 1 if CivicPassNorm13Change == 1
replace PassAnyResCountDummy13 = 1 if DualPassNorm13Change == 1
replace PassAnyResCountDummy13 = 1 if YearsPassNorm13Change == 1
replace PassAnyResCountDummy13 = 1 if JusPassNorm13Change == 1
replace PassAnyResCountDummy13 = 1 if LegalPassNorm13Change == 1
replace PassAnyResCountDummy13 = 1 if FamPassNorm13Change == 1
replace PassAnyResCountDummy13 = 1 if EthnicPassNorm13Change == 1

///Salience
gen AlonFonSalience = per601 + per605 + per607 + per608 + per705
gen Saliencetest = AlonFonSalience, by(country data)
bysort country date: egen Saliencetest2 = mean(AlonFonSalience)

///From ParlGov for Cabinet Orientation
gen partycabinetweight = seats*left_right if 
bysort cabinet_id: egen cabinetseats = total(seats) if cabinet_party == 1
bysort cabinet_id: egen sumcabinetweight = total(partycabinetweight) if cabinet_party == 1
bysort cabinet_id: gen cabinetlrscore = sumcabinetweight/cabinetseats
	
///ICCIStartType
bysort CountryCode: gen ICCIStartType = ICCIStrategyCode if Year == 1970
bysort CountryCode (ICCIStartType): replace ICCIStartType = ICCIStrategyCode[1]
replace ICCIStartType = 0 if ICCIStartType == 2
replace ICCIStartType = 1 if ICCIStartType == 4

///Logged Foreign Born Percent
gen logForBornPercent = 0
replace logForBornPercent = log(ForBornPercent) if ForBornPercent != 0

///Lagged Variables
by CountryCode: gen WBGDPGrowthLag = WBGDPGrowth[_n-1]
by CountryCode: gen WBGDPpc2005Lag = WBGDPpc2005[_n-1]
by CountryCode: gen WBNatUnempLag = WBNatUnemp[_n-1]
by CountryCode: gen MigRateLag = MigRate[_n-1]

///Variable Labels
lab var logForBornPercent "Foreign Born Percent (log)"
lab var MigRateLag "Migration Rate (lagged)"
lab var WBUrban "Urban"
lab var WBGDPGrowth "GDP Growth"
label define StartTypes 1 "Liberal" 2 "Restrictive"
label values ICCIStartType StartTypes
lab var RLPVS "Radical Left Vote"
lab var RRPVS "Radical Right Vote" 
lab var RLPVSAveChange "Change, Radical Left Vote" 
lab var RRPVSAveChange "Change, Radical Right Vote"
lab var DLPVSLAveChange "Change, Dominant Left Vote" 
lab var DRPVSRAveChange "Change, Dominant Right Vote" 
lab var LSPercent "Left Party Seats"
lab var RSPercent "Right Party Seats"
lab define GovTypes 1 "Left" 2 "Center" 3 "Right"
lab values LRScore3 GovTypes 
lab define RRGovTypes 1 "Far Right in Gov't" 0 "No Far Right in Gov't" 
lab values RRGov RRGovTypes 
lab define RLGovTypes 1 "Far Left/Green in Gov't" 0 "No Far Left in Gov't" 
lab values RLGov RLGovTypes 
lab var RLSPercent "Radical Left Seats" 
lab var RRSPercent "Radical Right Seats" 
lab var CabinetLRScore "Left-Right Cabinet Score"
lab var ICCIStartType "Citizenship Start Type"
lab define ICCIStartTypes 1 "Liberal" 0 "Restrictive" 
lab values ICCIStartType ICCIStartTypes

****************************** TABLE 1 (R&R): OLS REGRESSION MODELS TABLE, ELECTION CLUSTERD, FULL SAMPLE ******************************
qui regress TotalPassNorm13Diff RRPVS RLPVS logForBornPercent MigRateLag WBGDPGrowth i.ICCIStartType if Year >= 1975, vce(cluster ElectionCode) // 
	estimates store Table1Model1
	///rvfplot
qui regress TotalPassNorm13Diff RRPVSAveChange RLPVSAveChange logForBornPercent MigRateLag WBGDPGrowth i.ICCIStartType if Year >= 1975, vce(cluster ElectionCode) // 
	estimates store Table1Model2
qui regress TotalPassNorm13Diff ib2.LRScore3 logForBornPercent MigRateLag WBGDPGrowth i.ICCIStartType if Year >= 1975, vce(cluster ElectionCode) // 
	estimates store Table1Model3
qui regress TotalPassNorm13Diff i.RRGov i.RLGov logForBornPercent MigRateLag WBGDPGrowth i.ICCIStartType if Year >= 1975, vce(cluster ElectionCode) // 
	estimates store Table1Model4
qui regress TotalPassNorm13Diff ENRP ENLP ib2.LRScore3 logForBornPercent MigRateLag WBGDPGrowth i.ICCIStartType if Year >= 1975, vce(cluster ElectionCode) //
	estimates store Table1Model5
qui regress TotalPassNorm13Diff c.ENRP##ib1.LRScore3 ENLP logForBornPercent MigRateLag WBGDPGrowth i.ICCIStartType if Year >= 1975 , vce(cluster ElectionCode) // 
	estimates store Table1Model6
qui regress TotalPassNorm13Diff c.ENLP##ib3.LRScore3 ENRP logForBornPercent MigRateLag WBGDPGrowth i.ICCIStartType if Year >= 1975, vce(cluster ElectionCode) // 
	estimates store Table1Model7
qui regress TotalPassNorm13Diff CabinetLRScore logForBornPercent MigRateLag WBGDPGrowth i.ICCIStartType if Year >= 1975, vce(cluster ElectionCode) // 
	estimates store Table1Model8
esttab Table1Model3 Table1Model8 Table1Model1 Table1Model2 Table1Model5 Table1Model6 Table1Model7 Table1Model4 ///
	using Table1Models, rtf replace ///
	b(%9.2f) se(%9.2f) starlevels(* .1 ** .05 *** .01) scalars(N "N_clust {Clusters}" "r2 {\i R}{\super 2}") sfmt(%9.2f %9.2f %9.2f)   ///
	drop(1.LRScore3#c.ENRP 3.LRScore3#c.ENLP  0.RRGov 0.RLGov 0.ICCIStartType) ///
	order(1.LRScore3 3.LRScore3 2.LRScore3 CabinetLRScore RRPVS RLPVS RRPVSAveChange RLPVSAveChange ENRP ENLP 2.LRScore3#c.ENRP 3.LRScore3#c.ENRP 1.LRScore3#c.ENLP 2.LRScore3#c.ENLP 1.RRGov 1.RLGov logForBornPercent MigRateLag WBGDPGrowth 1.ICCIStartType) ///
	onecell ///						// 	coefficients and SE in same cell
	/// staraux /// 				// 	puts stars on SE or T stats instead coeffic when putting them together in once cell
	label /// 						//	use variable labels
	modelwidth(3) varwidth (12) ///	//	footprint, modelw (inches), var (@1/12inches)								
	/// nolz /// 					// 	stops the leading zeroes before the decimal point--estab/estout specific
	nogaps /// 						// 	removes spacing between lines 
	nonumbers ///					//	remove numbers from the models
	interaction(" x ") ///			//  include interaction symbol
	mlabels("1" "2" "3" "4" "5" "6" "7" "8") ///	// Model/Column titles
	title("Table 1: Estimated Effects on Net Citizenship Policy Change (OLS)")

****************************** APPENDIX 1 (R&R): OLS REGRESSION MODELS TABLE, ELECTION CLUSTERD, WITH SALIENCE, FULL SAMPLE ******************************
qui regress TotalPassNorm13Diff RRPVS RLPVS Salience logForBornPercent MigRateLag WBGDPGrowth i.ICCIStartType if Year >= 1975, vce(cluster ElectionCode) // 
	estimates store Appendix1Model1
	///rvfplot
qui regress TotalPassNorm13Diff RRPVSAveChange RLPVSAveChange Salience logForBornPercent MigRateLag WBGDPGrowth i.ICCIStartType if Year >= 1975, vce(cluster ElectionCode) // 
	estimates store Appendix1Model2
qui regress TotalPassNorm13Diff ib2.LRScore3 Salience logForBornPercent MigRateLag WBGDPGrowth i.ICCIStartType if Year >= 1975, vce(cluster ElectionCode) // 
	estimates store Appendix1Model3
qui regress TotalPassNorm13Diff i.RRGov i.RLGov Salience logForBornPercent MigRateLag WBGDPGrowth i.ICCIStartType if Year >= 1975, vce(cluster ElectionCode) // 
	estimates store Appendix1Model4
qui regress TotalPassNorm13Diff ENRP ENLP ib2.LRScore3 Salience logForBornPercent MigRateLag WBGDPGrowth i.ICCIStartType if Year >= 1975, vce(cluster ElectionCode) //
	estimates store Appendix1Model5
qui regress TotalPassNorm13Diff c.ENRP##ib1.LRScore3 ENLP Salience logForBornPercent MigRateLag WBGDPGrowth i.ICCIStartType if Year >= 1975 , vce(cluster ElectionCode) // 
	estimates store Appendix1Model6
qui regress TotalPassNorm13Diff c.ENLP##ib3.LRScore3 ENRP Salience logForBornPercent MigRateLag WBGDPGrowth i.ICCIStartType if Year >= 1975, vce(cluster ElectionCode) // 
	estimates store Appendix1Model7
	//pwcorr Salience RRPVS
qui regress TotalPassNorm13Diff CabinetLRScore Salience logForBornPercent MigRateLag WBGDPGrowth i.ICCIStartType if Year >= 1975, vce(cluster ElectionCode) // 
	estimates store Appendix1Model8
esttab Appendix1Model3 Appendix1Model8 Appendix1Model1 Appendix1Model2 Appendix1Model5 Appendix1Model6 Appendix1Model7 Appendix1Model4 ///
	using Appendix1Models, rtf replace ///
	b(%9.2f) se(%9.2f) starlevels(* .1 ** .05 *** .01) scalars(N "N_clust {Clusters}" "r2 {\i R}{\super 2}") sfmt(%9.2f %9.2f %9.2f)   ///
	drop(1.LRScore3#c.ENRP 3.LRScore3#c.ENLP  0.RRGov 0.RLGov 0.ICCIStartType) ///
	order(1.LRScore3 3.LRScore3 2.LRScore3 CabinetLRScore RRPVS RLPVS RRPVSAveChange RLPVSAveChange ENRP ENLP 2.LRScore3#c.ENRP 3.LRScore3#c.ENRP 1.LRScore3#c.ENLP 2.LRScore3#c.ENLP 1.RRGov 1.RLGov Salience logForBornPercent MigRateLag WBGDPGrowth 1.ICCIStartType) ///
	onecell ///						// 	coefficients and SE in same cell
	/// staraux /// 				// 	puts stars on SE or T stats instead coeffic when putting them together in once cell
	label /// 						//	use variable labels
	modelwidth(3) varwidth (12) ///	//	footprint, modelw (inches), var (@1/12inches)								
	/// nolz /// 					// 	stops the leading zeroes before the decimal point--estab/estout specific
	nogaps /// 						// 	removes spacing between lines 
	nonumbers ///					//	remove numbers from the models
	interaction(" x ") ///			//  include interaction symbol
	mlabels("1" "2" "3" "4" "5" "6" "7" "8") ///	// Model/Column titles
	title("Appendix Table 1: Estimated Effects on Net Citizenship Policy Change (OLS)")

****************************** APPENDIX 2 (R&R): OLS REGRESSION MODELS TABLE, ELECTION CLUSTERD, WITH CabinetLRScore, FULL SAMPLE ******************************
qui regress TotalPassNorm13Diff RRPVS RLPVS CabinetLRScore logForBornPercent MigRateLag WBGDPGrowth i.ICCIStartType if Year >= 1975, vce(cluster ElectionCode) // 
	estimates store Appendix2Model1
	///rvfplot
qui regress TotalPassNorm13Diff RRPVSAveChange RLPVSAveChange CabinetLRScore logForBornPercent MigRateLag WBGDPGrowth i.ICCIStartType if Year >= 1975, vce(cluster ElectionCode) // 
	estimates store Appendix2Model2
qui regress TotalPassNorm13Diff CabinetLRScore logForBornPercent MigRateLag WBGDPGrowth i.ICCIStartType if Year >= 1975, vce(cluster ElectionCode) // 
	estimates store Appendix2Model3
qui regress TotalPassNorm13Diff i.RRGov i.RLGov logForBornPercent MigRateLag WBGDPGrowth i.ICCIStartType if Year >= 1975, vce(cluster ElectionCode) // 
	estimates store Appendix2Model4
qui regress TotalPassNorm13Diff ENRP ENLP CabinetLRScore logForBornPercent MigRateLag WBGDPGrowth i.ICCIStartType if Year >= 1975, vce(cluster ElectionCode) //
	estimates store Appendix2Model5
qui regress TotalPassNorm13Diff c.ENRP##c.CabinetLRScore ENLP logForBornPercent MigRateLag WBGDPGrowth i.ICCIStartType if Year >= 1975 , vce(cluster ElectionCode) // 
	estimates store Appendix2Model6
qui regress TotalPassNorm13Diff c.ENLP##c.CabinetLRScore ENRP logForBornPercent MigRateLag WBGDPGrowth i.ICCIStartType if Year >= 1975, vce(cluster ElectionCode) // 
	estimates store Appendix2Model7
esttab Appendix2Model3 Appendix2Model1 Appendix2Model2 Appendix2Model5 Appendix2Model6 Appendix2Model7 Appendix2Model4 ///
	using Appendix2Models, rtf replace ///
	b(%9.2f) se(%9.2f) starlevels(* .1 ** .05 *** .01) scalars(N "N_clust {Clusters}" "r2 {\i R}{\super 2}") sfmt(%9.2f %9.2f %9.2f)   ///
	drop(0.RRGov 0.RLGov 0.ICCIStartType) ///
	order(CabinetLRScore RRPVS RLPVS RRPVSAveChange RLPVSAveChange ENRP ENLP c.CabinetLRScore#c.ENRP c.CabinetLRScore#c.ENLP 1.RRGov logForBornPercent MigRateLag WBGDPGrowth 1.ICCIStartType) ///
	onecell ///						// 	coefficients and SE in same cell
	/// staraux /// 				// 	puts stars on SE or T stats instead coeffic when putting them together in once cell
	label /// 						//	use variable labels
	modelwidth(3.5) varwidth (12) ///	//	footprint, modelw (inches), var (@1/12inches)								
	/// nolz /// 					// 	stops the leading zeroes before the decimal point--estab/estout specific
	nogaps /// 						// 	removes spacing between lines 
	nonumbers ///					//	remove numbers from the models
	interaction(" x ") ///			//  include interaction symbol
	mlabels("1" "2" "3" "4" "5" "6" "7") ///	// Model/Column titles
	title("Appendix Table 2: Estimated Effects on Net Citizenship Policy Change (OLS)")
	

****************************** APPENDIX 3 (R&R): OLS REGRESSION MODELS TABLE, ELECTION CLUSTERD, WITH LPR, FULL SAMPLE ******************************
qui regress TotalPassNorm13Diff RRPVS RLPVS LPR LPRsq logForBornPercent MigRateLag WBGDPGrowth i.ICCIStartType if Year >= 1975, vce(cluster ElectionCode) //  
	estimates store Appendix3Model1
qui regress TotalPassNorm13Diff RRPVSAveChange RLPVSAveChange LPR LPRsq logForBornPercent MigRateLag WBGDPGrowth i.ICCIStartType if Year >= 1975, vce(cluster ElectionCode) //  
	estimates store Appendix3Model2
qui regress TotalPassNorm13Diff ib2.LRScore3 LPR LPRsq logForBornPercent MigRateLag WBGDPGrowth i.ICCIStartType if Year >= 1975, vce(cluster ElectionCode) //  
	estimates store Appendix3Model3
qui regress TotalPassNorm13Diff i.RRGov i.RLGov LPR LPRsq logForBornPercent MigRateLag WBGDPGrowth i.ICCIStartType if Year >= 1975, vce(cluster ElectionCode) //   
	estimates store Appendix3Model4
qui regress TotalPassNorm13Diff ENRP ENLP ib2.LRScore3 LPR LPRsq logForBornPercent MigRateLag WBGDPGrowth i.ICCIStartType if Year >= 1975, vce(cluster ElectionCode) //
	estimates store Appendix3Model5
qui regress TotalPassNorm13Diff c.ENRP##ib1.LRScore3 ENLP LPR LPRsq logForBornPercent MigRateLag WBGDPGrowth i.ICCIStartType if Year >= 1975 , vce(cluster ElectionCode) // 
	estimates store Appendix3Model6
qui regress TotalPassNorm13Diff c.ENLP##ib3.LRScore3 ENRP LPR LPRsq logForBornPercent MigRateLag WBGDPGrowth i.ICCIStartType if Year >= 1975, vce(cluster ElectionCode) // 
	estimates store Appendix3Model7
regress TotalPassNorm13Diff CabinetLRScore LPR LPRsq logForBornPercent MigRateLag WBGDPGrowth i.ICCIStartType if Year >= 1975, vce(cluster ElectionCode) // 
	estimates store Appendix3Model8
esttab Appendix3Model3 Appendix3Model8 Appendix3Model1 Appendix3Model2 Appendix3Model5 Appendix3Model6 Appendix3Model7 Appendix3Model4 ///
	using Appendix3Models, rtf replace ///
	b(%9.2f) se(%9.2f) starlevels(* .1 ** .05 *** .01) scalars(N "N_clust {Clusters}" "r2 {\i R}{\super 2}") sfmt(%9.2f %9.2f %9.2f)   ///
	drop(1.LRScore3#c.ENRP 3.LRScore3#c.ENLP  0.RRGov 0.RLGov 0.ICCIStartType) ///
	order(1.LRScore3 3.LRScore3 2.LRScore3 CabinetLRScore RRPVS RLPVS RRPVSAveChange RLPVSAveChange ENRP ENLP 2.LRScore3#c.ENRP 3.LRScore3#c.ENRP 1.LRScore3#c.ENLP 2.LRScore3#c.ENLP 1.RRGov 1.RLGov LPR LPRsq logForBornPercent MigRateLag WBGDPGrowth 1.ICCIStartType) ///
	onecell ///						// 	coefficients and SE in same cell
	/// staraux /// 				// 	puts stars on SE or T stats instead coeffic when putting them together in once cell
	label /// 						//	use variable labels
	modelwidth(4) varwidth (12) ///	//	footprint, modelw (inches), var (@1/12inches)								
	/// nolz /// 					// 	stops the leading zeroes before the decimal point--estab/estout specific
	nogaps /// 						// 	removes spacing between lines 
	nonumbers ///					//	remove numbers from the models
	interaction(" x ") ///			//  include interaction symbol
	mlabels("1" "2" "3" "4" "5" "6" "7" "8") ///	// Model/Column titles
	title("Appendix Table 3: Estimated Effects on Net Citizenship Policy Change (OLS)")
	
****************************** APPENDIX 4 (R&R): OLS REGRESSION MODELS TABLE, ELECTION CLUSTERD, WITH TOTAL CHANGES DV, FULL SAMPLE ******************************
qui regress TotalPassNorm13Changes RRPVS RLPVS logForBornPercent MigRateLag WBGDPGrowth i.ICCIStartType if Year >= 1975, vce(cluster ElectionCode) //  
	estimates store Appendix4Model1
qui regress TotalPassNorm13Changes RRPVSAveChange RLPVSAveChange logForBornPercent MigRateLag WBGDPGrowth i.ICCIStartType if Year >= 1975, vce(cluster ElectionCode) //  
	estimates store Appendix4Model2
qui regress TotalPassNorm13Changes ib2.LRScore3 logForBornPercent MigRateLag WBGDPGrowth i.ICCIStartType if Year >= 1975, vce(cluster ElectionCode) //  
	estimates store Appendix4Model3
qui regress TotalPassNorm13Changes i.RRGov i.RLGov logForBornPercent MigRateLag WBGDPGrowth i.ICCIStartType if Year >= 1975, vce(cluster ElectionCode) //   
	estimates store Appendix4Model4
qui regress TotalPassNorm13Changes ENRP ENLP ib2.LRScore3 logForBornPercent MigRateLag WBGDPGrowth i.ICCIStartType if Year >= 1975, vce(cluster ElectionCode) //
	estimates store Appendix4Model5
qui regress TotalPassNorm13Changes c.ENRP##ib1.LRScore3 ENLP logForBornPercent MigRateLag WBGDPGrowth i.ICCIStartType if Year >= 1975 , vce(cluster ElectionCode) // 
	estimates store Appendix4Model6
qui regress TotalPassNorm13Changes c.ENLP##ib3.LRScore3 ENRP logForBornPercent MigRateLag WBGDPGrowth i.ICCIStartType if Year >= 1975, vce(cluster ElectionCode) // 
	estimates store Appendix4Model7
qui regress TotalPassNorm13Changes CabinetLRScore logForBornPercent MigRateLag WBGDPGrowth i.ICCIStartType if Year >= 1975, vce(cluster ElectionCode) // 
	estimates store Appendix4Model8
esttab Appendix4Model3 Appendix4Model8 Appendix4Model1 Appendix4Model2 Appendix4Model5 Appendix4Model6 Appendix4Model7 Appendix4Model4 ///
	using Appendix4Models, rtf replace ///
	b(%9.2f) se(%9.2f) starlevels(* .1 ** .05 *** .01) scalars(N "N_clust {Clusters}" "r2 {\i R}{\super 2}") sfmt(%9.2f %9.2f %9.2f)   ///
	drop(1.LRScore3#c.ENRP 3.LRScore3#c.ENLP  0.RRGov 0.RLGov 0.ICCIStartType) ///
	order(1.LRScore3 3.LRScore3 2.LRScore3 CabinetLRScore RRPVS RLPVS RRPVSAveChange RLPVSAveChange ENRP ENLP 2.LRScore3#c.ENRP 3.LRScore3#c.ENRP 1.LRScore3#c.ENLP 2.LRScore3#c.ENLP 1.RRGov 1.RLGov logForBornPercent MigRateLag WBGDPGrowth 1.ICCIStartType) ///
	onecell ///						// 	coefficients and SE in same cell
	/// staraux /// 				// 	puts stars on SE or T stats instead coeffic when putting them together in once cell
	label /// 						//	use variable labels
	modelwidth(3) varwidth (12) ///	//	footprint, modelw (inches), var (@1/12inches)								
	/// nolz /// 					// 	stops the leading zeroes before the decimal point--estab/estout specific
	nogaps /// 						// 	removes spacing between lines 
	nonumbers ///					//	remove numbers from the models
	interaction(" x ") ///			//  include interaction symbol
	mlabels("1" "2" "3" "4" "5" "6" "7" "8") ///	// Model/Column titles
	title("Appendix Table 4: Estimated Effects on Net Number of Citizenship Policy Changes (OLS)")
	
****************************** APPENDIX 5 (R&R): OLS REGRESSION MODELS TABLE, ELECTION CLUSTERD, WITH OVERWEIGHTED JUS/DOUBLE/FAM, FULL SAMPLE ******************************
qui regress TotalPassNorm13weightedDiff RRPVS RLPVS logForBornPercent MigRateLag WBGDPGrowth i.ICCIStartType if Year >= 1975, vce(cluster ElectionCode) //  
	estimates store Appendix5Model1
qui regress TotalPassNorm13weightedDiff RRPVSAveChange RLPVSAveChange logForBornPercent MigRateLag WBGDPGrowth i.ICCIStartType if Year >= 1975, vce(cluster ElectionCode) //  
	estimates store Appendix5Model2
qui regress TotalPassNorm13weightedDiff ib2.LRScore3 logForBornPercent MigRateLag WBGDPGrowth i.ICCIStartType if Year >= 1975, vce(cluster ElectionCode) //  
	estimates store Appendix5Model3
qui regress TotalPassNorm13weightedDiff i.RRGov i.RLGov logForBornPercent MigRateLag WBGDPGrowth i.ICCIStartType if Year >= 1975, vce(cluster ElectionCode) //   
	estimates store Appendix5Model4
qui regress TotalPassNorm13weightedDiff ENRP ENLP ib2.LRScore3 logForBornPercent MigRateLag WBGDPGrowth i.ICCIStartType if Year >= 1975, vce(cluster ElectionCode) //
	estimates store Appendix5Model5
qui regress TotalPassNorm13weightedDiff c.ENRP##ib1.LRScore3 ENLP logForBornPercent MigRateLag WBGDPGrowth i.ICCIStartType if Year >= 1975 , vce(cluster ElectionCode) // 
	estimates store Appendix5Model6
qui regress TotalPassNorm13weightedDiff c.ENLP##ib3.LRScore3 ENRP logForBornPercent MigRateLag WBGDPGrowth i.ICCIStartType if Year >= 1975, vce(cluster ElectionCode) // 
	estimates store Appendix5Model7
qui regress TotalPassNorm13weightedDiff CabinetLRScore logForBornPercent MigRateLag WBGDPGrowth i.ICCIStartType if Year >= 1975, vce(cluster ElectionCode) // 
	estimates store Appendix5Model8
esttab Appendix5Model3 Appendix5Model8 Appendix5Model1 Appendix5Model2 Appendix5Model5 Appendix5Model6 Appendix5Model7 Appendix5Model4 ///
	using Appendix5Models, rtf replace ///
	b(%9.2f) se(%9.2f) starlevels(* .1 ** .05 *** .01) scalars(N "N_clust {Clusters}" "r2 {\i R}{\super 2}") sfmt(%9.2f %9.2f %9.2f)   ///
	drop(1.LRScore3#c.ENRP 3.LRScore3#c.ENLP  0.RRGov 0.RLGov 0.ICCIStartType) ///
	order(1.LRScore3 3.LRScore3 2.LRScore3 CabinetLRScore RRPVS RLPVS RRPVSAveChange RLPVSAveChange ENRP ENLP 2.LRScore3#c.ENRP 3.LRScore3#c.ENRP 1.LRScore3#c.ENLP 2.LRScore3#c.ENLP 1.RRGov 1.RLGov logForBornPercent MigRateLag WBGDPGrowth 1.ICCIStartType) ///
	onecell ///						// 	coefficients and SE in same cell
	/// staraux /// 				// 	puts stars on SE or T stats instead coeffic when putting them together in once cell
	label /// 						//	use variable labels
	modelwidth(3) varwidth (12) ///	//	footprint, modelw (inches), var (@1/12inches)								
	/// nolz /// 					// 	stops the leading zeroes before the decimal point--estab/estout specific
	nogaps /// 						// 	removes spacing between lines 
	nonumbers ///					//	remove numbers from the models
	interaction(" x ") ///			//  include interaction symbol
	mlabels("1" "2" "3" "4" "5" "6" "7" "8") ///	// Model/Column titles
	title("Appendix Table 5: Estimated Effects on Net Weighted Citizenship Policy Change (OLS)")
	
****************************** APPENDIX 6 (R&R): OLS REGRESSION MODELS TABLE, ELECTION CLUSTERD, WITH IMMPOLICY VARIABLE, FULL SAMPLE ******************************
qui regress TotalPassNorm13Diff RRPVS RLPVS OrtegaPeri_Entry OrtegaPeri_Stay OrtegaPeri_asylum logForBornPercent MigRateLag WBGDPGrowth i.ICCIStartType if Year >= 1975, vce(cluster ElectionCode) //  
	estimates store Appendix6Model1
	///rvfplot
qui regress TotalPassNorm13Diff RRPVSAveChange RLPVSAveChange OrtegaPeri_Entry OrtegaPeri_Stay OrtegaPeri_asylum logForBornPercent MigRateLag WBGDPGrowth i.ICCIStartType if Year >= 1975, vce(cluster ElectionCode) //  
	estimates store Appendix6Model2
qui regress TotalPassNorm13Diff ib2.LRScore3 OrtegaPeri_Entry OrtegaPeri_Stay OrtegaPeri_asylum logForBornPercent MigRateLag WBGDPGrowth i.ICCIStartType if Year >= 1975, vce(cluster ElectionCode) //  
	estimates store Appendix6Model3
qui regress TotalPassNorm13Diff i.RRGov i.RLGov OrtegaPeri_Entry OrtegaPeri_Stay OrtegaPeri_asylum logForBornPercent MigRateLag WBGDPGrowth i.ICCIStartType if Year >= 1975, vce(cluster ElectionCode) //   
	estimates store Appendix6Model4
qui regress TotalPassNorm13Diff ENRP ENLP ib2.LRScore3 OrtegaPeri_Entry OrtegaPeri_Stay OrtegaPeri_asylum logForBornPercent MigRateLag WBGDPGrowth i.ICCIStartType if Year >= 1975, vce(cluster ElectionCode) //
	estimates store Appendix6Model5
qui regress TotalPassNorm13Diff c.ENRP##ib1.LRScore3 ENLP OrtegaPeri_Entry OrtegaPeri_Stay OrtegaPeri_asylum logForBornPercent MigRateLag WBGDPGrowth i.ICCIStartType if Year >= 1975 , vce(cluster ElectionCode) // 
	estimates store Appendix6Model6
qui regress TotalPassNorm13Diff c.ENLP##ib3.LRScore3 ENRP OrtegaPeri_Entry OrtegaPeri_Stay OrtegaPeri_asylum logForBornPercent MigRateLag WBGDPGrowth i.ICCIStartType if Year >= 1975, vce(cluster ElectionCode) // 
	estimates store Appendix6Model7
qui regress TotalPassNorm13Diff CabinetLRScore OrtegaPeri_Entry OrtegaPeri_Stay OrtegaPeri_asylum logForBornPercent MigRateLag WBGDPGrowth i.ICCIStartType if Year >= 1975, vce(cluster ElectionCode) // 
	estimates store Appendix6Model8
esttab Appendix6Model3 Appendix6Model8 Appendix6Model1 Appendix6Model2 Appendix6Model5 Appendix6Model6 Appendix6Model7 Appendix6Model4 ///
	using Appendix6Models, rtf replace ///
	b(%9.2f) se(%9.2f) starlevels(* .1 ** .05 *** .01) scalars(N "N_clust {Clusters}" "r2 {\i R}{\super 2}") sfmt(%9.2f %9.2f %9.2f)   ///
	drop(1.LRScore3#c.ENRP 3.LRScore3#c.ENLP  0.RRGov 0.RLGov 0.ICCIStartType) ///
	order(1.LRScore3 3.LRScore3 2.LRScore3 CabinetLRScore RRPVS RLPVS RRPVSAveChange RLPVSAveChange ENRP ENLP 2.LRScore3#c.ENRP 3.LRScore3#c.ENRP 1.LRScore3#c.ENLP 2.LRScore3#c.ENLP 1.RRGov 1.RLGov OrtegaPeri_Entry OrtegaPeri_Stay OrtegaPeri_asylum logForBornPercent MigRateLag WBGDPGrowth 1.ICCIStartType) ///
	onecell ///						// 	coefficients and SE in same cell
	/// staraux /// 				// 	puts stars on SE or T stats instead coeffic when putting them together in once cell
	label /// 						//	use variable labels
	modelwidth(3) varwidth (12) ///	//	footprint, modelw (inches), var (@1/12inches)								
	/// nolz /// 					// 	stops the leading zeroes before the decimal point--estab/estout specific
	nogaps /// 						// 	removes spacing between lines 
	nonumbers ///					//	remove numbers from the models
	interaction(" x ") ///			//  include interaction symbol
	mlabels("1" "2" "3" "4" "5" "6" "7" "8") ///	// Model/Column titles
	title("Appendix 6: Estimated Effects on Net Citizenship Policy Change (OLS)")
	
****************************** APPENDIX 7 (R&R): OLS REGRESSION MODELS TABLE, ELECTION CLUSTERD, WITH LIBERAL PARTIES, FULL SAMPLE ******************************
qui regress TotalPassNorm13Diff RRPVS RLPVS LIBPVS logForBornPercent MigRateLag WBGDPGrowth i.ICCIStartType if Year >= 1975, vce(cluster ElectionCode) //  
	estimates store Appendix7Model1
	//rvfplot
//qui regress TotalPassNorm13Diff RRPVSAveChange RLPVSAveChange logForBornPercent MigRateLag WBGDPGrowth i.ICCIStartType if Year >= 1975, vce(cluster ElectionCode) //  
	//estimates store Appendix7Model2
qui regress TotalPassNorm13Diff LIBPVS logForBornPercent MigRateLag WBGDPGrowth i.ICCIStartType if Year >= 1975, vce(cluster ElectionCode) //  
	estimates store Appendix7Model3
qui regress TotalPassNorm13Diff i.LibGov logForBornPercent MigRateLag WBGDPGrowth i.ICCIStartType if Year >= 1975, vce(cluster ElectionCode) //   
	estimates store Appendix7Model4
//qui regress TotalPassNorm13Diff ENRP##i.LibGov ENLP logForBornPercent MigRateLag WBGDPGrowth i.ICCIStartType if Year >= 1975, vce(cluster ElectionCode) //
	//estimates store Appendix7Model5
qui regress TotalPassNorm13Diff i.LibGov##c.ENRP ENLP logForBornPercent MigRateLag WBGDPGrowth i.ICCIStartType if Year >= 1975 , vce(cluster ElectionCode) // 
	estimates store Appendix7Model6
qui regress TotalPassNorm13Diff i.LibGov##c.ENLP ENRP logForBornPercent MigRateLag WBGDPGrowth i.ICCIStartType if Year >= 1975, vce(cluster ElectionCode) // 
	estimates store Appendix7Model7
esttab Appendix7Model3 Appendix7Model1 Appendix7Model4 Appendix7Model6 Appendix7Model7 ///
	using Appendix7Models, rtf replace ///
	b(%9.2f) se(%9.2f) starlevels(* .1 ** .05 *** .01) scalars(N "N_clust {Clusters}" "r2 {\i R}{\super 2}") sfmt(%9.2f %9.2f %9.2f)   ///
	drop(0.LibGov 0.LibGov#c.ENRP 0.LibGov#c.ENLP 0.LibGov#c.ENRP 0.ICCIStartType) ///
	order(LIBPVS RRPVS RLPVS 1.LibGov ENRP ENLP 1.LibGov#c.ENRP 1.LibGov#c.ENLP logForBornPercent MigRateLag WBGDPGrowth 1.ICCIStartType) ///
	onecell ///						// 	coefficients and SE in same cell
	/// staraux /// 				// 	puts stars on SE or T stats instead coeffic when putting them together in once cell
	label /// 						//	use variable labels
	modelwidth(3) varwidth (12) ///	//	footprint, modelw (inches), var (@1/12inches)								
	/// nolz /// 					// 	stops the leading zeroes before the decimal point--estab/estout specific
	nogaps /// 						// 	removes spacing between lines 
	nonumbers ///					//	remove numbers from the models
	interaction(" x ") ///			//  include interaction symbol
	mlabels("1" "2" "3" "4" "5") ///	// Model/Column titles
	title("Appendix 7: Estimated Effects on Net Citizenship Policy Change (OLS)")
	
****************************** TABLE 2 (R&R): RARE EVENTS COMBINED LOGIT TABLE, ELECTION CLUSTERED ********************************************************
quietly firthlogit PassAnyResDummy13 RPVS RRPVS logForBornPercent MigRateLag i.ICCIStartType if Year >= 1975, nolog or //
	estimates store Table2Res1
quietly firthlogit PassAnyResDummy13 RSPercent RRSPercent logForBornPercent MigRateLag i.ICCIStartType if Year >= 1975, nolog or //
	estimates store Table2Res2
quietly firthlogit PassAnyResDummy13 ENRP i.RightGov logForBornPercent MigRateLag i.ICCIStartType if Year >= 1975, nolog or //
	estimates store Table2Res3
quietly firthlogit PassAnyResDummy13 c.ENRP##i.RightGov logForBornPercent MigRateLag i.ICCIStartType if Year >= 1975, nolog or //
	estimates store Table2Res4
quietly firthlogit PassAnyResDummy13 i.RRGov logForBornPercent MigRateLag i.ICCIStartType if Year >= 1975, nolog or //
	estimates store Table2Res5
quietly firthlogit PassAnyResDummy13 c.RRPVS##i.RightGov logForBornPercent MigRateLag i.ICCIStartType if Year >= 1975, nolog or //
	estimates store Table2Res6
quietly firthlogit PassAnyLibDummy13 LPVS RLPVS logForBornPercent MigRateLag i.ICCIStartType if Year >= 1975, nolog or //
	estimates store Table2Lib1
quietly firthlogit PassAnyLibDummy13 LSPercent RLSPercent logForBornPercent MigRateLag i.ICCIStartType if Year >= 1975, nolog or //
	estimates store Table2Lib2
quietly firthlogit PassAnyLibDummy13 ENLP i.LeftGov logForBornPercent MigRateLag i.ICCIStartType if Year >= 1975, nolog or //
	estimates store Table2Lib3
quietly firthlogit PassAnyLibDummy13 c.ENLP##i.LeftGov logForBornPercent MigRateLag i.ICCIStartType if Year >= 1975, nolog or //
		margins , at(ENLP=(1 3) LeftGov=0) atmeans post expression(invlogit(predict(xb)))
	estimates store Table2Lib4
quietly firthlogit PassAnyLibDummy13 i.RLGov logForBornPercent MigRateLag i.ICCIStartType if Year >= 1975, nolog or //
	estimates store Table2Lib5
quietly firthlogit PassAnyLibDummy13 c.RLPVS##i.LeftGov logForBornPercent MigRateLag i.ICCIStartType if Year >= 1975, nolog or //
	estimates store Table2Lib6
esttab Table2Res1 Table2Res5 Table2Res3 Table2Res4 Table2Res6 ///
	using Table2ResModels, rtf replace ///
	b(%9.2f) se(%9.2f) starlevels(* .1 ** .05 *** .01) scalars(N chi2 "pr2 {Pseudo} {\i R}{\super 2}") sfmt(%9.2f %9.2f %9.2f)   ///
	drop(0.RightGov#c.ENRP 0.RightGov#c.RRPVS 0.RRGov 0.RightGov 0.ICCIStartType) ///
	order(RPVS RRPVS RSPercent RRSPercent 1.RightGov 1.RRGov ENRP 1.RightGov#c.ENRP 1.RightGov#c.RRPVS logForBornPercent MigRateLag 1.ICCIStartType) ///
	onecell ///						// 	coefficients and SE in same cell
	eform /// 						// 	report odds ratios
	/// staraux /// 				// 	puts stars on SE or T stats instead coeffic when putting them together in once cell
	label /// 						//	use variable labels
	modelwidth(3) varwidth (12) ///	//	footprint, modelw (inches), var (@1/12inches)								
	/// nolz /// 					// 	stops the leading zeroes before the decimal point--estab/estout specific
	nogaps /// 						// 	removes spacing between lines 
	nonumbers ///					//	remove numbers from the models
	interaction(" x ") ///			//  include interaction symbol
	mlabels("1" "2" "3" "4" "5") ///	// Model/Column titles
	title("Table 2. Estimated Effects of Party Competition on Liberalizations and Restrictions (Rare Events Logistic Regression)")
esttab Table2Lib1 Table2Lib5 Table2Lib3 Table2Lib4 Table2Lib6 ///
	using Table2LibModels, rtf replace ///
	b(%9.2f) se(%9.2f) starlevels(* .1 ** .05 *** .01) scalars(N chi2 "pr2 {Pseudo} {\i R}{\super 2}") sfmt(%9.2f %9.2f %9.2f)   ///
	drop(0.LeftGov#c.ENLP 0.LeftGov#c.RLPVS 0.RLGov 0.LeftGov 0.ICCIStartType) ///
	order(LPVS RLPVS LSPercent RLSPercent 1.LeftGov 1.RLGov ENLP 1.LeftGov#c.ENLP 1.LeftGov#c.RLPVS logForBornPercent MigRateLag 1.ICCIStartType) ///
	onecell ///						// 	coefficients and SE in same cell
	eform /// 						// 	report odds ratios
	/// staraux /// 				// 	puts stars on SE or T stats instead coeffic when putting them together in once cell
	label /// 						//	use variable labels
	modelwidth(3) varwidth (12) ///	//	footprint, modelw (inches), var (@1/12inches)								
	/// nolz /// 					// 	stops the leading zeroes before the decimal point--estab/estout specific
	nogaps /// 						// 	removes spacing between lines 
	nonumbers ///					//	remove numbers from the models
	interaction(" x ") ///			//  include interaction symbol
	mlabels("1" "2" "3" "4" "5") ///	// Model/Column titles
	title("Table 2. Estimated Effects of Party Competition on Liberalizations and Restrictions (Rare Events Logistic Regression)")

****************************** APPENDIX 8 (R&R): COMBINED LOGITS, ELECTION CLUSTERED ********************************************************
quietly logit PassAnyResDummy13 RPVS RRPVS logForBornPercent MigRateLag i.ICCIStartType if Year >= 1975, cluster(ElectionCode) nolog or //
	estimates store Appendix8Res1
quietly logit PassAnyResDummy13 RSPercent RRSPercent logForBornPercent MigRateLag i.ICCIStartType if Year >= 1975, cluster(ElectionCode) nolog or //
	estimates store Appendix8Res2
quietly logit PassAnyResDummy13 ENRP i.RightGov logForBornPercent MigRateLag i.ICCIStartType if Year >= 1975, cluster(ElectionCode) nolog or //
	estimates store Appendix8Res3
quietly logit PassAnyResDummy13 c.ENRP##i.RightGov logForBornPercent MigRateLag i.ICCIStartType if Year >= 1975, cluster(ElectionCode) nolog or //
	estimates store Appendix8Res4
quietly logit PassAnyResDummy13 i.RRGov logForBornPercent MigRateLag i.ICCIStartType if Year >= 1975, cluster(ElectionCode) nolog or //
	estimates store Appendix8Res5
quietly logit PassAnyResDummy13 c.RRPVS##i.RightGov logForBornPercent MigRateLag i.ICCIStartType if Year >= 1975, nolog or //
	estimates store Appendix8Res6
quietly logit PassAnyLibDummy13 LPVS RLPVS logForBornPercent MigRateLag i.ICCIStartType if Year >= 1975, cluster(ElectionCode) nolog or //
	estimates store Appendix8Lib1
quietly logit PassAnyLibDummy13 LSPercent RLSPercent logForBornPercent MigRateLag i.ICCIStartType if Year >= 1975, cluster(ElectionCode) nolog or //
	estimates store Appendix8Lib2
quietly logit PassAnyLibDummy13 ENLP i.LeftGov logForBornPercent MigRateLag i.ICCIStartType if Year >= 1975, cluster(ElectionCode) nolog or //
	estimates store Appendix8Lib3
quietly logit PassAnyLibDummy13 c.ENLP##i.LeftGov logForBornPercent MigRateLag i.ICCIStartType if Year >= 1975, cluster(ElectionCode) nolog or //
	estimates store Appendix8Lib4
quietly logit PassAnyLibDummy13 i.RLGov logForBornPercent MigRateLag i.ICCIStartType if Year >= 1975, cluster(ElectionCode) nolog or //
	estimates store Appendix8Lib5
quietly logit PassAnyLibDummy13 c.RLPVS##i.LeftGov logForBornPercent MigRateLag i.ICCIStartType if Year >= 1975, nolog or //
	estimates store Appendix8Lib6
esttab Appendix8Res1 Appendix8Res5 Appendix8Res3 Appendix8Res4 Appendix8Res6 ///
	using Appendix8ResModels, rtf replace ///
	b(%9.2f) se(%9.2f) starlevels(* .1 ** .05 *** .01) scalars(N chi2 "pr2 {Pseudo} {\i R}{\super 2}") sfmt(%9.2f %9.2f %9.2f)   ///
	drop(0.RightGov#c.ENRP 0.RightGov#c.RRPVS 0.RRGov 0.RightGov 0.ICCIStartType) ///
	order(RPVS RRPVS RSPercent RRSPercent 1.RightGov 1.RRGov ENRP 1.RightGov#c.ENRP 1.RightGov#c.RRPVS logForBornPercent MigRateLag 1.ICCIStartType) ///
	onecell ///						// 	coefficients and SE in same cell
	eform /// 						// 	report odds ratios
	/// staraux /// 				// 	puts stars on SE or T stats instead coeffic when putting them together in once cell
	label /// 						//	use variable labels
	modelwidth(3) varwidth (12) ///	//	footprint, modelw (inches), var (@1/12inches)								
	/// nolz /// 					// 	stops the leading zeroes before the decimal point--estab/estout specific
	nogaps /// 						// 	removes spacing between lines 
	nonumbers ///					//	remove numbers from the models
	interaction(" x ") ///			//  include interaction symbol
	mlabels("1" "2" "3" "4" "5") ///	// Model/Column titles
	title("Table 2. Estimated Effects of Party Competition on Liberalizations and Restrictions (Rare Events Logistic Regression)")
esttab Appendix8Lib1  Appendix8Lib5 Appendix8Lib3 Appendix8Lib4 Appendix8Lib6 ///
	using Appendix8LibModels, rtf replace ///
	b(%9.2f) se(%9.2f) starlevels(* .1 ** .05 *** .01) scalars(N chi2 "pr2 {Pseudo} {\i R}{\super 2}") sfmt(%9.2f %9.2f %9.2f)   ///
	drop(0.LeftGov#c.ENLP 0.LeftGov#c.RLPVS 0.RLGov 0.LeftGov 0.ICCIStartType) ///
	order(LPVS RLPVS LSPercent RLSPercent 1.LeftGov 1.RLGov ENLP 1.LeftGov#c.ENLP 1.LeftGov#c.RLPVS logForBornPercent MigRateLag 1.ICCIStartType) ///
	onecell ///						// 	coefficients and SE in same cell
	eform /// 						// 	report odds ratios
	/// staraux /// 				// 	puts stars on SE or T stats instead coeffic when putting them together in once cell
	label /// 						//	use variable labels
	modelwidth(3) varwidth (12) ///	//	footprint, modelw (inches), var (@1/12inches)								
	/// nolz /// 					// 	stops the leading zeroes before the decimal point--estab/estout specific
	nogaps /// 						// 	removes spacing between lines 
	nonumbers ///					//	remove numbers from the models
	interaction(" x ") ///			//  include interaction symbol
	mlabels("1" "2" "3" "4" "5") ///	// Model/Column titles
	title("Table 2. Estimated Effects of Party Competition on Liberalizations and Restrictions (Rare Events Logistic Regression)")

****************************** APPENDIX 9 (R&R): RARE EVENTS COMBINED LOGIT TABLE, SALIENCE  ********************************************************
quietly firthlogit PassAnyResDummy13 RPVS RRPVS Salience logForBornPercent MigRateLag i.ICCIStartType if Year >= 1975, nolog or //
	estimates store Appendix9Res1
quietly firthlogit PassAnyResDummy13 RSPercent RRSPercent Salience logForBornPercent MigRateLag i.ICCIStartType if Year >= 1975, nolog or //
	estimates store Appendix9Res2
quietly firthlogit PassAnyResDummy13 ENRP i.RightGov Salience logForBornPercent MigRateLag i.ICCIStartType if Year >= 1975, nolog or //
	estimates store Appendix9Res3
quietly firthlogit PassAnyResDummy13 c.ENRP##i.RightGov Salience logForBornPercent MigRateLag i.ICCIStartType if Year >= 1975, nolog or //
	estimates store Appendix9Res4
quietly firthlogit PassAnyResDummy13 i.RRGov Salience logForBornPercent MigRateLag i.ICCIStartType if Year >= 1975, nolog or //
	estimates store Appendix9Res5
quietly firthlogit PassAnyResDummy13 c.RRPVS##i.RightGov Salience logForBornPercent MigRateLag i.ICCIStartType if Year >= 1975, nolog or //
	estimates store Appendix9Res6
quietly firthlogit PassAnyLibDummy13 LPVS RLPVS Salience logForBornPercent MigRateLag i.ICCIStartType if Year >= 1975, nolog or //
	estimates store Appendix9Lib1
quietly firthlogit PassAnyLibDummy13 LSPercent RLSPercent Salience logForBornPercent MigRateLag i.ICCIStartType if Year >= 1975, nolog or //
	estimates store Appendix9Lib2
quietly firthlogit PassAnyLibDummy13 ENLP i.LeftGov Salience logForBornPercent MigRateLag i.ICCIStartType if Year >= 1975, nolog or //
	estimates store Appendix9Lib3
quietly firthlogit PassAnyLibDummy13 c.ENLP##i.LeftGov Salience logForBornPercent MigRateLag i.ICCIStartType if Year >= 1975, nolog or //
	estimates store Appendix9Lib4
quietly firthlogit PassAnyLibDummy13 i.RLGov Salience logForBornPercent MigRateLag i.ICCIStartType if Year >= 1975, nolog or //
	estimates store Appendix9Lib5
quietly firthlogit PassAnyLibDummy13 c.RLPVS##i.LeftGov Salience logForBornPercent MigRateLag i.ICCIStartType if Year >= 1975, nolog or //
	estimates store Appendix9Lib6
esttab Appendix9Res1 Appendix9Res5 Appendix9Res3 Appendix9Res4 Appendix9Res6 ///
	using Appendix9ResModels, rtf replace ///
	b(%9.2f) se(%9.2f) starlevels(* .1 ** .05 *** .01) scalars(N chi2 "pr2 {Pseudo} {\i R}{\super 2}") sfmt(%9.2f %9.2f %9.2f)   ///
	drop(0.RightGov#c.ENRP 0.RightGov#c.RRPVS 0.RRGov 0.RightGov 0.ICCIStartType) ///
	order(RPVS RRPVS RSPercent RRSPercent 1.RightGov 1.RRGov ENRP 1.RightGov#c.ENRP 1.RightGov#c.RRPVS Salience logForBornPercent MigRateLag 1.ICCIStartType) ///
	onecell ///						// 	coefficients and SE in same cell
	eform /// 						// 	report odds ratios
	/// staraux /// 				// 	puts stars on SE or T stats instead coeffic when putting them together in once cell
	label /// 						//	use variable labels
	modelwidth(3) varwidth (12) ///	//	footprint, modelw (inches), var (@1/12inches)								
	/// nolz /// 					// 	stops the leading zeroes before the decimal point--estab/estout specific
	nogaps /// 						// 	removes spacing between lines 
	nonumbers ///					//	remove numbers from the models
	interaction(" x ") ///			//  include interaction symbol
	mlabels("1" "2" "3" "4" "5") ///	// Model/Column titles
	title("Table 2. Estimated Effects of Party Competition on Liberalizations and Restrictions (Rare Events Logistic Regression)")
esttab Appendix9Lib1 Appendix9Lib5 Appendix9Lib3 Appendix9Lib4 Appendix9Lib6 ///
	using Appendix9LibModels, rtf replace ///
	b(%9.2f) se(%9.2f) starlevels(* .1 ** .05 *** .01) scalars(N chi2 "pr2 {Pseudo} {\i R}{\super 2}") sfmt(%9.2f %9.2f %9.2f)   ///
	drop(0.LeftGov#c.ENLP 0.LeftGov#c.RLPVS 0.RLGov 0.LeftGov 0.ICCIStartType) ///
	order(LPVS RLPVS LSPercent RLSPercent 1.LeftGov 1.RLGov ENLP 1.LeftGov#c.ENLP 1.LeftGov#c.RLPVS Salience logForBornPercent MigRateLag 1.ICCIStartType) ///
	onecell ///						// 	coefficients and SE in same cell
	eform /// 						// 	report odds ratios
	/// staraux /// 				// 	puts stars on SE or T stats instead coeffic when putting them together in once cell
	label /// 						//	use variable labels
	modelwidth(3) varwidth (12) ///	//	footprint, modelw (inches), var (@1/12inches)								
	/// nolz /// 					// 	stops the leading zeroes before the decimal point--estab/estout specific
	nogaps /// 						// 	removes spacing between lines 
	nonumbers ///					//	remove numbers from the models
	interaction(" x ") ///			//  include interaction symbol
	mlabels("1" "2" "3" "4" "5") ///	// Model/Column titles
	title("Table 2. Estimated Effects of Party Competition on Liberalizations and Restrictions (Rare Events Logistic Regression)")

****************************** APPENDIX 10 (R&R): RARE EVENTS LOGIT, LIBERALxGOV'T ********************************************************
regress TotalPassNorm13Diff ib0.ICCIStartType##ib2.LRScore3 logForBornPercent MigRateLag if Year >= 1975, vce(cluster ElectionCode) //  
	estimates store Appendix10Model1
regress TotalPassNorm13Diff ib2.LRScore3 logForBornPercent MigRateLag if (Year >= 1975 & ICCIStartType == 1), vce(cluster ElectionCode) //  
	estimates store Appendix10Lib1
qui firthlogit PassAnyLibCountDummy13 ib2.LRScore3 logForBornPercent MigRateLag if (Year >= 1975 & ICCIStartType == 1), nolog or //
	estimates store Appendix10Lib2
qui firthlogit PassAnyResCountDummy13 ib2.LRScore3 logForBornPercent MigRateLag if (Year >= 1975 & ICCIStartType == 1), nolog or //
	estimates store Appendix10Lib3
regress TotalPassNorm13Diff ib2.LRScore3 logForBornPercent MigRateLag if (Year >= 1975 & ICCIStartType == 0), vce(cluster ElectionCode) //  
	estimates store Appendix10Res1
qui firthlogit PassAnyLibCountDummy13 ib2.LRScore3 logForBornPercent MigRateLag if (Year >= 1975 & ICCIStartType == 0), nolog or //
	estimates store Appendix10Res2
qui firthlogit PassAnyResCountDummy13 ib2.LRScore3 logForBornPercent MigRateLag if (Year >= 1975 & ICCIStartType == 0), nolog or //
	estimates store Appendix10Res3
esttab Appendix10Model1 Appendix10Lib1 Appendix10Lib2 Appendix10Lib3 Appendix10Res1 Appendix10Res2 Appendix10Res3 ///
	using Appendix10Models, rtf replace ///
	b(%9.2f) se(%9.2f) starlevels(* .1 ** .05 *** .01) scalars(N chi2 r2 "pr2 {Pseudo} {\i R}{\super 2}") sfmt(%9.2f %9.2f %9.2f)   ///
	///drop(0.RightGov#c.ENRP 0.RRGov 0.RightGov 0.ICCIStartType) ///
	///order(RPVS RRPVS RSPercent RRSPercent 1.RightGov 1.RRGov ENRP 1.RightGov#c.ENRP logForBornPercent MigRateLag 1.ICCIStartType) ///
	onecell ///						// 	coefficients and SE in same cell
	eform /// 						// 	report odds ratios
	/// staraux /// 				// 	puts stars on SE or T stats instead coeffic when putting them together in once cell
	label /// 						//	use variable labels
	modelwidth(3) varwidth (12) ///	//	footprint, modelw (inches), var (@1/12inches)								
	/// nolz /// 					// 	stops the leading zeroes before the decimal point--estab/estout specific
	nogaps /// 						// 	removes spacing between lines 
	nonumbers ///					//	remove numbers from the models
	interaction(" x ") ///			//  include interaction symbol
	mlabels("1" "2" "3" "4" "5" "6" "7") ///	// Model/Column titles
	title("Appendix 10. Estimated Effects of Path Dependence")

****************************** FIGURE 2: Interactive Effects on Citizenship Policy Change  ********************************************************
****************************** ENLP x LRScore3
qui regress TotalPassNorm13Diff c.ENLP##ib2.LRScore3 ENRP logForBornPercent MigRateLag WBGDPGrowth i.ICCIStartType if Year >= 1975 , vce(cluster ElectionCode) // 
	margins , at(ENLP=(1(.5)3.5) LRScore3=(1) ) atmeans post 
	est store Figure2ENLPMargins1
qui regress TotalPassNorm13Diff c.ENLP##ib2.LRScore3 ENRP logForBornPercent MigRateLag WBGDPGrowth i.ICCIStartType if Year >= 1975 , vce(cluster ElectionCode) // 
	margins , at(ENLP=(1(.5)3.5) LRScore3=(2) ) atmeans post 
	est store Figure2ENLPMargins2
qui regress TotalPassNorm13Diff c.ENLP##ib2.LRScore3 ENRP logForBornPercent MigRateLag WBGDPGrowth i.ICCIStartType if Year >= 1975 , vce(cluster ElectionCode) // 
	margins , at(ENLP=(1(.5)3.5) LRScore3=(3) ) atmeans post 
	est store Figure2ENLPMargins3
	coefplot ///				 
			(Figure2ENLPMargins1, msym(T) label("Left Governments")) ///	Estimates (reordered into a more logical order for results)
			(Figure2ENLPMargins2, msym(O) label("Centrist Governments") offset(-.1)) ///		(c) "Offsets" distribute markers so they aren't stacked
			(Figure2ENLPMargins3, msym(S) label("Right Governments") offset(+.1)) ///		(c) "Offsets" distribute markers so they aren't stacked
			, vertical ///
			///
			mcolor(black) msize(medsmall) /// 		marker characteristics that apply to all of markers
			///
			///
			legend (position(6) margin(tiny) bmargin(l+5 t+2)) ///			Position (o'clock and ring = 0 here to put legend in empty cell...
			/// legend (ring(4)) ///											Needs the bmargin settings adjusted to work well.
			legend(rows(2)) ///  											Rows(1) to put all of the legend labels on a horizontal line; cols(1) vert 
			legend(size(*.85) symysize(*.8) symxsize(*.6) keygap(vsmall) ) ///	Relative sizing to change the text size in the legend; gap bw marker and text
			///
			///
			///at recast(line) ///
			ciopts( ///							Color & width of the CI bands around the estimates 
				lcolor(black) /// 
				lwidth(vthin) ///
				recast(rcap) ///
				) ///
			///
			///ciopts(recast(rline) lpattern(dash))
			ytitle("Predicted Citizenship Policy Change" , size(*.7) margin (l+.5 ) ) /// Margin moves the label out from the axis 
			yscale(range(-.5(.1).5)) ylabel(-.5(.1).5) ///
			ylabel(,labsize(*.6)) /// Size of the labels on the y-axis 
			ylabel(, grid glwidth(vthin) glcolor(gs10) glpattern(shortdash)) /// Look of the grid
			///
			b1title ("ENLP" , size(small)) /// xtitle("ENLP") /// b1title ("`figname'" , size(small)) /// using b1title puts stops the x-title from encroaching on x-axis
		/// Notice: Use "`figname'" so that first loop through grabs first "local figname" above to rotate axis names depending on dv 
			///xscale(range(.5 3.5)) /// Add a little space--.5 units here--at the front and end of the x-axis  
			xlabel(,labsize(*.55)) /// Size of the labels on the x-axis 			
			/// xlabel(, alternate) /// Angle of the labels on the x-axis 	
			/// xlabel(, angle(315)) /// Angle of the labels on the x-axis 	
			/// 
			xlabel( 1 `"1"'  2 `"1.5"' 3 `"2"' 4 `"2.5"' 5 `"3"' 6 `"3.5"') /// Label the 11 estimates created with each model above
			///
			title("Marginal Effects of ENLP on Citizenship Policy Change",size(*.5) color(black) margin(r+0 b-.5 t+5) ) /// margin(r+10 to move titles (r,l,b, t) to make room
			scale(.9) graphregion(color(white) margin(small)) /// scale graphy ; White background instead of Stata blue; margins to create space between figures 
			///graph display, xsize(2.5) ysize(2.5) /// Change these to increase/decrease figure dimensions
			saving(Figure2ENLPEffects.gph, replace)	
			///graph export "Figure1Libs1.tif", replace

****************************** ENRP x LRScore3
qui regress TotalPassNorm13Diff c.ENRP##ib2.LRScore3 ENLP logForBornPercent MigRateLag WBGDPGrowth i.ICCIStartType if Year >= 1975 , vce(cluster ElectionCode) // 
	margins , at(ENRP=(1(.5)3.5) LRScore3=(1) ) atmeans post 
	est store Figure2ENRPMargins1
qui regress TotalPassNorm13Diff c.ENRP##ib2.LRScore3 ENLP logForBornPercent MigRateLag WBGDPGrowth i.ICCIStartType if Year >= 1975 , vce(cluster ElectionCode) // 
	margins , at(ENRP=(1(.5)3.5) LRScore3=(2) ) atmeans post 
	est store Figure2ENRPMargins2
qui regress TotalPassNorm13Diff c.ENRP##ib2.LRScore3 ENLP logForBornPercent MigRateLag WBGDPGrowth i.ICCIStartType if Year >= 1975 , vce(cluster ElectionCode) // 
	margins , at(ENRP=(1(.5)3.5) LRScore3=(3) ) atmeans post 
	est store Figure2ENRPMargins3
	coefplot ///				 
			(Figure2ENRPMargins1, msym(T) label("Left Governments")) ///	Estimates (reordered into a more logical order for results)
			(Figure2ENRPMargins2, msym(O) label("Centrist Governments") offset(-.1)) ///		(c) "Offsets" distribute markers so they aren't stacked
			(Figure2ENRPMargins3, msym(S) label("Right Governments") offset(+.1)) ///		(c) "Offsets" distribute markers so they aren't stacked
			, vertical ///
			///
			mcolor(black) msize(medsmall) /// 		marker characteristics that apply to all of markers
			///
			///
			legend (position(6) margin(tiny) bmargin(l+5 t+2)) ///			Position (o'clock and ring = 0 here to put legend in empty cell...
			/// legend (ring(4)) ///											Needs the bmargin settings adjusted to work well.
			legend(rows(2)) ///  											Rows(1) to put all of the legend labels on a horizontal line; cols(1) vert 
			legend(size(*.85) symysize(*.8) symxsize(*.6) keygap(vsmall) ) ///	Relative sizing to change the text size in the legend; gap bw marker and text
			///
			///
			///at recast(line) ///
			ciopts( ///							Color & width of the CI bands around the estimates 
				lcolor(black) /// 
				lwidth(vthin) ///
				recast(rcap) ///
				) ///
			///
			///ciopts(recast(rline) lpattern(dash))
			ytitle("Predicted Citizenship Policy Change" , size(*.7) margin (l+.5 ) ) /// Margin moves the label out from the axis 
			yscale(range(-.5(.1).5)) ylabel(-.5(.1).5) ///
			ylabel(,labsize(*.6)) /// Size of the labels on the y-axis 
			ylabel(, grid glwidth(vthin) glcolor(gs10) glpattern(shortdash)) /// Look of the grid
			///
			b1title ("ENRP" , size(small))  /// xtitle("ENRP Score") /// b1title ("`figname'" , size(small)) /// using b1title puts stops the x-title from encroaching on x-axis
			/// Notice: Use "`figname'" so that first loop through grabs first "local figname" above to rotate axis names depending on dv 
			///xscale(range(.5 5.0)) /// Add a little space--.5 units here--at the front and end of the x-axis  
			xlabel(,labsize(*.55)) /// Size of the labels on the x-axis 			
			/// xlabel(, alternate) /// Angle of the labels on the x-axis 	
			/// xlabel(, angle(315)) /// Angle of the labels on the x-axis 	
			/// 
			xlabel( 1 `"1"'  2 `"1.5"' 3 `"2"' 4 `"2.5"' 5 `"3"' 6 `"3.5"') /// Label the 11 estimates created with each model above
			///
			title("Marginal Effects of ENRP on Citizenship Policy Change",size(*.5) color(black) margin(r+0 b-.5 t+5) ) /// margin(r+10 to move titles (r,l,b, t) to make room
			scale(.9) graphregion(color(white) margin(small)) /// scale graphy ; White background instead of Stata blue; margins to create space between figures 
			///graph display, xsize(2.5) ysize(2.5) /// Change these to increase/decrease figure dimensions
			saving(Figure2ENRPEffects.gph, replace)	

****************************** RLPVS x LRScore3
qui regress TotalPassNorm13Diff c.RLPVS##ib2.LRScore3 logForBornPercent MigRateLag WBGDPGrowth i.ICCIStartType if Year >= 1975 , vce(cluster ElectionCode) // 
	margins , at(RLPVS=(0(5)35) LRScore3=(1) ) atmeans post 
	est store Figure2RLPVSMargins1
qui regress TotalPassNorm13Diff c.RLPVS##ib2.LRScore3 logForBornPercent MigRateLag WBGDPGrowth i.ICCIStartType if Year >= 1975 , vce(cluster ElectionCode) // 
	margins , at(RLPVS=(0(5)35) LRScore3=(2) ) atmeans post 
	est store Figure2RLPVSMargins2
qui regress TotalPassNorm13Diff c.RLPVS##ib2.LRScore3 logForBornPercent MigRateLag WBGDPGrowth i.ICCIStartType if Year >= 1975 , vce(cluster ElectionCode) // 
	margins , at(RLPVS=(0(5)35) LRScore3=(3) ) atmeans post 
	est store Figure2RLPVSMargins3
	coefplot ///				 
			(Figure2RLPVSMargins1, msym(T) label("Left Governments")) ///	Estimates (reordered into a more logical order for results)
			(Figure2RLPVSMargins2, msym(O) label("Centrist Governments") offset(-.1)) ///		(c) "Offsets" distribute markers so they aren't stacked
			(Figure2RLPVSMargins3, msym(S) label("Right Governments") offset(+.1)) ///		(c) "Offsets" distribute markers so they aren't stacked
			, vertical ///
			///
			mcolor(black) msize(medsmall) /// 		marker characteristics that apply to all of markers
			///
			///
			legend (position(6) margin(tiny) bmargin(l+5 t+2)) ///			Position (o'clock and ring = 0 here to put legend in empty cell...
			/// legend (ring(4)) ///											Needs the bmargin settings adjusted to work well.
			legend(rows(2)) ///  											Rows(1) to put all of the legend labels on a horizontal line; cols(1) vert 
			legend(size(*.85) symysize(*.8) symxsize(*.6) keygap(vsmall) ) ///	Relative sizing to change the text size in the legend; gap bw marker and text
			///
			///
			///at recast(line) ///
			ciopts( ///							Color & width of the CI bands around the estimates 
				lcolor(black) /// 
				lwidth(vthin) ///
				recast(rcap) ///
				) ///
			///
			///ciopts(recast(rline) lpattern(dash))
			ytitle("Predicted Citizenship Policy Change" , size(*.7) margin (l+.5 ) ) /// Margin moves the label out from the axis 
			yscale(range(-.5(.1).5)) ylabel(-.5(.1).5) ///
			ylabel(,labsize(*.6)) /// Size of the labels on the y-axis 
			ylabel(, grid glwidth(vthin) glcolor(gs10) glpattern(shortdash)) /// Look of the grid
			///
			b1title ("Green and Far Left Vote Share" , size(small)) /// xtitle("ENLP") /// b1title ("`figname'" , size(small)) /// using b1title puts stops the x-title from encroaching on x-axis
		/// Notice: Use "`figname'" so that first loop through grabs first "local figname" above to rotate axis names depending on dv 
			///xscale(range(.5 3.5)) /// Add a little space--.5 units here--at the front and end of the x-axis  
			xlabel(,labsize(*.55)) /// Size of the labels on the x-axis 			
			/// xlabel(, alternate) /// Angle of the labels on the x-axis 	
			/// xlabel(, angle(315)) /// Angle of the labels on the x-axis 	
			/// 
			xlabel( 1 `"0"'  2 `"5"' 3 `"10"' 4 `"15"' 5 `"20"' 6 `"25"' 7 `"30"' 8 `"35"') /// Label the 11 estimates created with each model above
			///
			title("Far Left Contagion Effects on Citizenship Policy Change",size(*.5) color(black) margin(r+0 b-.5 t+5) ) /// margin(r+10 to move titles (r,l,b, t) to make room
			scale(.9) graphregion(color(white) margin(small)) /// scale graphy ; White background instead of Stata blue; margins to create space between figures 
			///graph display, xsize(2.5) ysize(2.5) /// Change these to increase/decrease figure dimensions
			saving(Figure2RLPVSEffects.gph, replace)	
			///graph export "Figure1Libs1.tif", replace

****************************** RRPVS x LRScore3
qui regress TotalPassNorm13Diff c.RRPVS##ib2.LRScore3 logForBornPercent MigRateLag WBGDPGrowth i.ICCIStartType if Year >= 1975 , vce(cluster ElectionCode) // 
	margins , at(RRPVS=(0(5)30) LRScore3=(1) ) atmeans post 
	est store Figure2RRPVSMargins1
qui regress TotalPassNorm13Diff c.RRPVS##ib2.LRScore3 logForBornPercent MigRateLag WBGDPGrowth i.ICCIStartType if Year >= 1975 , vce(cluster ElectionCode) // 
	margins , at(RRPVS=(0(5)30) LRScore3=(2) ) atmeans post 
	est store Figure2RRPVSMargins2
qui regress TotalPassNorm13Diff c.RRPVS##ib2.LRScore3 logForBornPercent MigRateLag WBGDPGrowth i.ICCIStartType if Year >= 1975 , vce(cluster ElectionCode) // 
	margins , at(RRPVS=(0(5)30) LRScore3=(3) ) atmeans post 
	est store Figure2RRPVSMargins3
	coefplot ///				 
			(Figure2RRPVSMargins1, msym(T) label("Left Governments")) ///	Estimates (reordered into a more logical order for results)
			(Figure2RRPVSMargins2, msym(O) label("Centrist Governments") offset(-.1)) ///		(c) "Offsets" distribute markers so they aren't stacked
			(Figure2RRPVSMargins3, msym(S) label("Right Governments") offset(+.1)) ///		(c) "Offsets" distribute markers so they aren't stacked
			, vertical ///
			///
			mcolor(black) msize(medsmall) /// 		marker characteristics that apply to all of markers
			///
			///
			legend (position(6) margin(tiny) bmargin(l+5 t+2)) ///			Position (o'clock and ring = 0 here to put legend in empty cell...
			/// legend (ring(4)) ///											Needs the bmargin settings adjusted to work well.
			legend(rows(2)) ///  											Rows(1) to put all of the legend labels on a horizontal line; cols(1) vert 
			legend(size(*.85) symysize(*.8) symxsize(*.6) keygap(vsmall) ) ///	Relative sizing to change the text size in the legend; gap bw marker and text
			///
			///
			///at recast(line) ///
			ciopts( ///							Color & width of the CI bands around the estimates 
				lcolor(black) /// 
				lwidth(vthin) ///
				recast(rcap) ///
				) ///
			///
			///ciopts(recast(rline) lpattern(dash))
			ytitle("Predicted Citizenship Policy Change" , size(*.7) margin (l+.5 ) ) /// Margin moves the label out from the axis 
			yscale(range(-.4(.2).4)) ylabel(-.4(.2).4) ///
			ylabel(,labsize(*.6)) /// Size of the labels on the y-axis 
			ylabel(, grid glwidth(vthin) glcolor(gs10) glpattern(shortdash)) /// Look of the grid
			///
			b1title ("Radical Right Party Vote Share" , size(small))  /// xtitle("ENRP Score") /// b1title ("`figname'" , size(small)) /// using b1title puts stops the x-title from encroaching on x-axis
			/// Notice: Use "`figname'" so that first loop through grabs first "local figname" above to rotate axis names depending on dv 
			///xscale(range(.5 5.0)) /// Add a little space--.5 units here--at the front and end of the x-axis  
			xlabel(,labsize(*.55)) /// Size of the labels on the x-axis 			
			/// xlabel(, alternate) /// Angle of the labels on the x-axis 	
			/// xlabel(, angle(315)) /// Angle of the labels on the x-axis 	
			/// 
			xlabel( 1 `"0"'  2 `"5"' 3 `"10"' 4 `"15"' 5 `"20"' 6 `"25"' 7 `"30"' ) /// Label the 11 estimates created with each model above
			///
			title("Far Right Contagion Effects on Citizenship Policy Change",size(*.5) color(black) margin(r+0 b-.5 t+5) ) /// margin(r+10 to move titles (r,l,b, t) to make room
			scale(.9) graphregion(color(white) margin(small)) /// scale graphy ; White background instead of Stata blue; margins to create space between figures 
			///graph display, xsize(2.5) ysize(2.5) /// Change these to increase/decrease figure dimensions
			saving(Figure2RRPVSEffects.gph, replace)
			
		/* Now combine graphs */
			grc1leg /// This is a legend ado that creates one legend when graphs are combined
			  /// VERIFY THAT THESE MATCH "local varnames" 
			 Figure2ENLPEffects.gph
			 Figure2ENRPEffects.gph
			 Figure2RLPVSEffects.gph ///
			 Figure2RRPVSEffects.gph ///	
			, ///
			/// title(,size(medlarge)) ///
				graphregion(color(white) margin(zero)) 
				graph display, xsize(8) ysize(6.25) // grc1leg won't allow xsize option, but this works	
			///	capture drop  _est*	
		graph export ".\Figure1.tif", width(1500) replace
	

****************************** FIGURE 3: Interactive Effects on Binary Outcomes  ********************************************************
qui firthlogit PassAnyLibDummy13 c.ENLP##ib2.LRScore3 logForBornPercent MigRateLag i.ICCIStartType if Year >= 1975, nolog or //
	margins , at(ENLP=(1(.5)3) LRScore3=(1) ) atmeans post expression(invlogit(predict(xb)))
	est store Figure1LibMargins1
qui firthlogit PassAnyLibDummy13 c.ENLP##ib2.LRScore3 logForBornPercent MigRateLag i.ICCIStartType if Year >= 1975, nolog or //
	margins , at(ENLP=(1(.5)3) LRScore3=(2) ) atmeans post expression(invlogit(predict(xb)))
	est store Figure1LibMargins2
qui firthlogit PassAnyLibDummy13 c.ENLP##ib2.LRScore3 logForBornPercent MigRateLag i.ICCIStartType if Year >= 1975, nolog or //
	margins , at(ENLP=(1(.5)3) LRScore3=(3) ) atmeans post expression(invlogit(predict(xb)))
	est store Figure1LibMargins3
	coefplot ///				 
			(Figure1LibMargins1, msym(S) label("Left Governments")) ///	Estimates (reordered into a more logical order for results)
			(Figure1LibMargins2, msym(O) label("Centrist Governments") offset(-.1)) ///		(c) "Offsets" distribute markers so they aren't stacked
			(Figure1LibMargins3, msym(T) label("Right Governments") offset(+.1)) ///		(c) "Offsets" distribute markers so they aren't stacked
			, vertical ///
			///
			mcolor(black) msize(medsmall) /// 		marker characteristics that apply to all of markers
			///
			///
			legend (position(6) margin(tiny) bmargin(l+5 t+2)) ///			Position (o'clock and ring = 0 here to put legend in empty cell...
			/// legend (ring(4)) ///											Needs the bmargin settings adjusted to work well.
			legend(rows(2)) ///  											Rows(1) to put all of the legend labels on a horizontal line; cols(1) vert 
			legend(size(*.85) symysize(*.8) symxsize(*.6) keygap(vsmall) ) ///	Relative sizing to change the text size in the legend; gap bw marker and text
			///
			///
			///at recast(line) ///
			ciopts( ///							Color & width of the CI bands around the estimates 
				lcolor(black) /// 
				lwidth(vthin) ///
				recast(rcap) ///
				) ///
			///
			///ciopts(recast(rline) lpattern(dash))
			ytitle("Probability of Liberalization" , size(*.7) margin (l+.5 ) ) /// Margin moves the label out from the axis 
			yscale(range(0(.2)1)) ylabel(0(.2)1) ///
			ylabel(,labsize(*.6)) /// Size of the labels on the y-axis 
			ylabel(, grid glwidth(vthin) glcolor(gs10) glpattern(shortdash)) /// Look of the grid
			///
			b1title ("ENLP" , size(small)) /// xtitle("ENLP") /// b1title ("`figname'" , size(small)) /// using b1title puts stops the x-title from encroaching on x-axis
		/// Notice: Use "`figname'" so that first loop through grabs first "local figname" above to rotate axis names depending on dv 
			///xscale(range(.5 3.5)) /// Add a little space--.5 units here--at the front and end of the x-axis  
			xlabel(,labsize(*.55)) /// Size of the labels on the x-axis 			
			/// xlabel(, alternate) /// Angle of the labels on the x-axis 	
			/// xlabel(, angle(315)) /// Angle of the labels on the x-axis 	
			/// 
			xlabel( 1 `"1"'  2 `"1.5"' 3 `"2"' 4 `"2.5"' 5 `"3"') /// Label the 11 estimates created with each model above
			///
			title("Marginal Effects of ENLP on Liberalization",size(*.5) color(black) margin(r+0 b-.5 t+5) ) /// margin(r+10 to move titles (r,l,b, t) to make room
			scale(.9) graphregion(color(white) margin(small)) /// scale graphy ; White background instead of Stata blue; margins to create space between figures 
			///graph display, xsize(2.5) ysize(2.5) /// Change these to increase/decrease figure dimensions
			saving(Figure1Libs1.gph, replace)	
			///graph export "Figure1Libs1.tif", replace

qui firthlogit PassAnyResDummy13 c.ENRP##ib2.LRScore3 logForBornPercent MigRateLag i.ICCIStartType if Year >= 1975, nolog or //
	margins , at(ENRP=(1(.5)3.5) LRScore3=(3) ) atmeans post expression(invlogit(predict(xb)))
	est store Figure1ResMargins1
qui firthlogit PassAnyResDummy13 c.ENRP##ib2.LRScore3 logForBornPercent MigRateLag i.ICCIStartType if Year >= 1975, nolog or //
	margins , at(ENRP=(1(.5)3.5) LRScore3=(2) ) atmeans post expression(invlogit(predict(xb)))
	est store Figure1ResMargins2
qui firthlogit PassAnyResDummy13 c.ENRP##ib2.LRScore3 logForBornPercent MigRateLag i.ICCIStartType if Year >= 1975, nolog or //
	margins , at(ENRP=(1(.5)3.5) LRScore3=(1) ) atmeans post expression(invlogit(predict(xb)))
	est store Figure1ResMargins3
	coefplot ///				 
			(Figure1ResMargins1, msym(T) label("Right Governments")) ///	Estimates (reordered into a more logical order for results)
			(Figure1ResMargins2, msym(O) label("Centrist Governments") offset(-.1)) ///		(c) "Offsets" distribute markers so they aren't stacked
			(Figure1ResMargins3, msym(S) label("Left Governments") offset(+.1)) ///		(c) "Offsets" distribute markers so they aren't stacked
			, vertical ///
			///
			mcolor(black) msize(medsmall) /// 		marker characteristics that apply to all of markers
			///
			///
			legend (position(6) margin(tiny) bmargin(l+5 t+2)) ///			Position (o'clock and ring = 0 here to put legend in empty cell...
			/// legend (ring(4)) ///											Needs the bmargin settings adjusted to work well.
			legend(rows(2)) ///  											Rows(1) to put all of the legend labels on a horizontal line; cols(1) vert 
			legend(size(*.85) symysize(*.8) symxsize(*.6) keygap(vsmall) ) ///	Relative sizing to change the text size in the legend; gap bw marker and text
			///
			///
			///at recast(line) ///
			ciopts( ///							Color & width of the CI bands around the estimates 
				lcolor(black) /// 
				lwidth(vthin) ///
				recast(rcap) ///
				) ///
			///
			///ciopts(recast(rline) lpattern(dash))
			ytitle("Probability of Restriction" , size(*.7) margin (l+.5 ) ) /// Margin moves the label out from the axis 
			yscale(range(0(.2)1)) ylabel(0(.2)1) ///
			ylabel(,labsize(*.6)) /// Size of the labels on the y-axis 
			ylabel(, grid glwidth(vthin) glcolor(gs10) glpattern(shortdash)) /// Look of the grid
			///
			b1title ("ENRP" , size(small))  /// xtitle("ENRP Score") /// b1title ("`figname'" , size(small)) /// using b1title puts stops the x-title from encroaching on x-axis
			/// Notice: Use "`figname'" so that first loop through grabs first "local figname" above to rotate axis names depending on dv 
			///xscale(range(.5 5.0)) /// Add a little space--.5 units here--at the front and end of the x-axis  
			xlabel(,labsize(*.55)) /// Size of the labels on the x-axis 			
			/// xlabel(, alternate) /// Angle of the labels on the x-axis 	
			/// xlabel(, angle(315)) /// Angle of the labels on the x-axis 	
			/// 
			xlabel( 1 `"1"'  2 `"1.5"' 3 `"2"' 4 `"2.5"' 5 `"3"' 6 `"3.5"') /// Label the 11 estimates created with each model above
			///
			title("Marginal Effects of ENRP on Restriction",size(*.5) color(black) margin(r+0 b-.5 t+5) ) /// margin(r+10 to move titles (r,l,b, t) to make room
			scale(.9) graphregion(color(white) margin(small)) /// scale graphy ; White background instead of Stata blue; margins to create space between figures 
			///graph display, xsize(2.5) ysize(2.5) /// Change these to increase/decrease figure dimensions
			saving(Figure1Res1.gph, replace)	
			///graph save "Figure1Res1.gph", replace	
			///graph export "Figure1Libs1.tif", replace

			
		/* Now combine graphs */
			grc1leg /// This is a legend ado that creates one legend when graphs are combined
			  /// VERIFY THAT THESE MATCH "local varnames" 
			 Figure1Libs1.gph ///
			 Figure1Res1.gph ///	
			, ///
			/// title(,size(medlarge)) ///
				graphregion(color(white) margin(zero)) 
				graph display, xsize(8) ysize(6.25) // grc1leg won't allow xsize option, but this works	
			///	capture drop  _est*	
		graph export ".\Figure1.tif", width(1500) replace
	
****************************** FIGURE 1A ********************************************************

qui firthlogit PassAnyLibDummy13 c.RLPVS##ib2.LRScore3 logForBornPercent MigRateLag i.ICCIStartType if Year >= 1975, nolog or //
	margins , at(ENLP=(1(.5)3.5) LRScore3=(1) ) atmeans post expression(invlogit(predict(xb)))
	est store Figure1LibMargins1
qui firthlogit PassAnyLibDummy13 c.RLPVS##ib2.LRScore3 logForBornPercent MigRateLag i.ICCIStartType if Year >= 1975, nolog or //
	margins , at(ENLP=(1(.5)3.5) LRScore3=(2) ) atmeans post expression(invlogit(predict(xb)))
	est store Figure1LibMargins2
qui firthlogit PassAnyLibDummy13 c.RLPVS##ib2.LRScore3 logForBornPercent MigRateLag i.ICCIStartType if Year >= 1975, nolog or //
	margins , at(ENLP=(1(.5)3.5) LRScore3=(3) ) atmeans post expression(invlogit(predict(xb)))
	est store Figure1LibMargins3
	coefplot ///				 
			(Figure1LibMargins1, msym(S) label("Left Governments")) ///	Estimates (reordered into a more logical order for results)
			(Figure1LibMargins2, msym(O) label("Centrist Governments") offset(-.1)) ///		(c) "Offsets" distribute markers so they aren't stacked
			(Figure1LibMargins3, msym(T) label("Right Governments") offset(+.1)) ///		(c) "Offsets" distribute markers so they aren't stacked
			, vertical ///
			///
			mcolor(black) msize(medsmall) /// 		marker characteristics that apply to all of markers
			///
			///
			legend (position(6) margin(tiny) bmargin(l+5 t+2)) ///			Position (o'clock and ring = 0 here to put legend in empty cell...
			/// legend (ring(4)) ///											Needs the bmargin settings adjusted to work well.
			legend(rows(2)) ///  											Rows(1) to put all of the legend labels on a horizontal line; cols(1) vert 
			legend(size(*.85) symysize(*.8) symxsize(*.6) keygap(vsmall) ) ///	Relative sizing to change the text size in the legend; gap bw marker and text
			///
			///
			///at recast(line) ///
			ciopts( ///							Color & width of the CI bands around the estimates 
				lcolor(black) /// 
				lwidth(vthin) ///
				recast(rcap) ///
				) ///
			///
			///ciopts(recast(rline) lpattern(dash))
			ytitle("Probability of Liberalization" , size(*.7) margin (l+.5 ) ) /// Margin moves the label out from the axis 
			yscale(range(0(.2)1)) ylabel(0(.2)1) ///
			ylabel(,labsize(*.6)) /// Size of the labels on the y-axis 
			ylabel(, grid glwidth(vthin) glcolor(gs10) glpattern(shortdash)) /// Look of the grid
			///
			/// xtitle("") b1title ("`figname'" , size(small)) /// using b1title puts stops the x-title from encroaching on x-axis
		/// Notice: Use "`figname'" so that first loop through grabs first "local figname" above to rotate axis names depending on dv 
			///xscale(range(.5 3.5)) /// Add a little space--.5 units here--at the front and end of the x-axis  
			xlabel(,labsize(*.55)) /// Size of the labels on the x-axis 			
			/// xlabel(, alternate) /// Angle of the labels on the x-axis 	
			/// xlabel(, angle(315)) /// Angle of the labels on the x-axis 	
			/// 
			xlabel( 1 `"ENLP = 1"'  2 `"ENLP = 1.5"' 3 `"ENLP = 2"' 4 `"ENLP = 2.5"' 5 `"ENLP = 3"' 6 `"ENLP = 3.5"') /// Label the 11 estimates created with each model above
			///
			title("Marginal Effect of ENRP on Restriction, By Government Orientation",size(*.5) color(black) margin(r+0 b-.5 t+5) ) /// margin(r+10 to move titles (r,l,b, t) to make room
			scale(.9) graphregion(color(white) margin(small)) // scale graphy ; White background instead of Stata blue; margins to create space between figures 
			graph display, xsize(2.5) ysize(2.5) // Change these to increase/decrease figure dimensions
			graph save "Figure1Libs1.gph", replace	
			graph export "Figure1Libs1.tif", replace

qui firthlogit PassAnyLibDummy13 c.RLPVS##ib2.LRScore3 logForBornPercent MigRateLag i.ICCIStartType if Year >= 1975, nolog or //
	margins , at(RLPVS=(0(5)30) LRScore3=(1) ) atmeans post expression(invlogit(predict(xb)))
	est store Figure1LibMargins1A
qui firthlogit PassAnyLibDummy13 c.RLPVS##ib2.LRScore3 logForBornPercent MigRateLag i.ICCIStartType if Year >= 1975, nolog or //
	margins , at(RLPVS=(0(5)30) LRScore3=(2) ) atmeans post expression(invlogit(predict(xb)))
	est store Figure1AResMargins2A
qui firthlogit PassAnyResDummy13 c.RLPVS##ib2.LRScore3 logForBornPercent MigRateLag i.ICCIStartType if Year >= 1975, nolog or //
	margins , at(RLPVS=(0(5)30) LRScore3=(3) ) atmeans post expression(invlogit(predict(xb)))
	est store Figure1AResMargins3A
			
******************************* FIGURE 1A ****************************8
qui firthlogit PassAnyResDummy13 c.RRPVS##ib2.LRScore3 logForBornPercent MigRateLag i.ICCIStartType if Year >= 1975, nolog or //
	margins , at(RRPVS=(0(5)30) LRScore3=(3) ) atmeans post expression(invlogit(predict(xb)))
	est store Figure1AResMargins1A
qui firthlogit PassAnyResDummy13 c.RRPVS##ib2.LRScore3 logForBornPercent MigRateLag i.ICCIStartType if Year >= 1975, nolog or //
	margins , at(RRPVS=(0(5)30) LRScore3=(2) ) atmeans post expression(invlogit(predict(xb)))
	est store Figure1AResMargins2A
qui firthlogit PassAnyResDummy13 c.RRPVS##ib2.LRScore3 logForBornPercent MigRateLag i.ICCIStartType if Year >= 1975, nolog or //
	margins , at(RRPVS=(0(5)30) LRScore3=(1) ) atmeans post expression(invlogit(predict(xb)))
	est store Figure1AResMargins3A
	coefplot ///				 
			(Figure1ResMargins1A, msym(S) label("Right Governments")) ///	Estimates (reordered into a more logical order for results)
			(Figure1ResMargins2A, msym(O) label("Centrist Governments") offset(-.1)) ///		(c) "Offsets" distribute markers so they aren't stacked
			(Figure1ResMargins3A, msym(T) label("Left Governments") offset(+.1)) ///		(c) "Offsets" distribute markers so they aren't stacked
			, vertical ///
			///
			mcolor(black) msize(medsmall) /// 		marker characteristics that apply to all of markers
			///
			///
			legend (position(6) margin(tiny) bmargin(l+5 t+2)) ///			Position (o'clock and ring = 0 here to put legend in empty cell...
			/// legend (ring(4)) ///											Needs the bmargin settings adjusted to work well.
			legend(rows(2)) ///  											Rows(1) to put all of the legend labels on a horizontal line; cols(1) vert 
			legend(size(*.85) symysize(*.8) symxsize(*.6) keygap(vsmall) ) ///	Relative sizing to change the text size in the legend; gap bw marker and text
			///
			///
			///at recast(line) ///
			ciopts( ///							Color & width of the CI bands around the estimates 
				lcolor(black) /// 
				lwidth(vthin) ///
				recast(rcap) ///
				) ///
			///
			///ciopts(recast(rline) lpattern(dash))
			ytitle("Probability of Restriction" , size(*.7) margin (l+.5 ) ) /// Margin moves the label out from the axis 
			yscale(range(0(.2)1)) ylabel(0(.2)1) ///
			ylabel(,labsize(*.6)) /// Size of the labels on the y-axis 
			ylabel(, grid glwidth(vthin) glcolor(gs10) glpattern(shortdash)) /// Look of the grid
			///
			xtitle("Radical Right Party Vote Share" , size(*.7) margin (l+.5 ) ) ///) b1title ("`figname'" , size(small)) /// using b1title puts stops the x-title from encroaching on x-axis
		/// Notice: Use "`figname'" so that first loop through grabs first "local figname" above to rotate axis names depending on dv 
			///xscale(range(.5 5.0)) /// Add a little space--.5 units here--at the front and end of the x-axis  
			xlabel(,labsize(*.55)) /// Size of the labels on the x-axis 			
			/// xlabel(, alternate) /// Angle of the labels on the x-axis 	
			/// xlabel(, angle(315)) /// Angle of the labels on the x-axis 	
			/// 
			xlabel( 1 `"0"'  2 `"5"' 3 `"10"' 4 `"15"' 5 `"20"' 6 `"25"' 7 `"30"') /// Label the 11 estimates created with each model above
			///
			title("Marginal Effect of Radical Right Party Vote Share on Restriction, By Government Orientation",size(*.5) color(black) margin(r+0 b-.5 t+5) ) /// margin(r+10 to move titles (r,l,b, t) to make room
			scale(.9) graphregion(color(white) margin(small)) // scale graphy ; White background instead of Stata blue; margins to create space between figures 
			graph display, xsize(2.5) ysize(2.5) // Change these to increase/decrease figure dimensions
			local Figure1Res1
			graph save "Figure1Res1.gph", replace	
			graph export "Figure1Res1.tif", replace

			
		/* Now combine graphs */
			graph combine /// This is a legend ado that creates one legend when graphs are combined
			  /// VERIFY THAT THESE MATCH "local varnames" 
			 Figure1Res1.gph ///	
			, ///
			/// title(,size(medlarge)) ///
				graphregion(color(white) margin(zero)) 
				graph display, xsize(8) ysize(6.25) // grc1leg won't allow xsize option, but this works	
			///	capture drop  _est*	
		graph export ".\Figure1.tif", width(1500) replace
	
****************************** FIGURE 2 ********************************************************
qui firthlogit PassAnyResDummy13 ENRP logForBornPercent MigRateLag i.ICCIStartType if Year >= 1975, nolog or //
	margins , at(ENRP=(1(.5)4.5)) atmeans post expression(invlogit(predict(xb)))
	est store Figure2ResMargins1
qui firthlogit PassAnyLibDummy13 ENLP logForBornPercent MigRateLag i.ICCIStartType if Year >= 1975, nolog or //
	margins , at(ENLP=(1(.5)3.5)) atmeans post expression(invlogit(predict(xb)))
	est store Figure2LibMargins2
coefplot 	(Figure2ResMargins1, label( "ENRP") ///
					color(gs14) barwidth(0.25) bargap(1.5) ) ///
			(Figure2LibMargins2, label( "ENLP") ///
					color(gs8) barwidth(0.25) bargap(1.5)  ) ///
			, ///  
			vertical  ///  
			recast(bar) ///
			plotregion(margin(b=0)) /// Puts the bars right on x axis rather than having any space
			lcolor(black) /// bars will have blackoutline 
			citop barwidth(0.3) fcolor(*.5) /// add conf ints and put them ontop of the bars  
			ciopts(lwidth(*1) lcolor(black)  ) ///
			ylabel(,noticks) ///
		yscale(range(0 .8)) ///
		ylabel(0(.2).8) ///
		ylabel(, grid glwidth(vthin) glcolor(gs10) glpattern(shortdash)) /// Look of the grid
		ylabel(, labsize(small)) ///
		ytitle("Probability of Liberalization (ENLP) or Restriction (ENRP)", size(small)) ///
		///xscale(range(1 4.5)) ///xlabel( ) ///
		/// xlabel(, grid glwidth(vthin) glcolor(gs12) glpattern(shortdash)) /// 
		/// xline(.1882935  , lwidth(vthin) lcolor(gs5)) /// Add line for typical respond at mean marg effects
		/// xline (.4344295  , lwidth(vthin) lcolor(gs8)) /// Add line for typical respond at mean marg effects
		/// xtitle("") b1title ("Sexism Score, 0-1", size(small)) ///
		/// 
		xlabel( 1 `"1"'  2 `"1.5"' 3 `"2"' 4 `"2.5"' 5 `"3"' 6 `"3.5"' 7 `"4"' 8 `"4.5"') /// Label the 11 estimates created with each model above
		xlabel(, labsize(*.55)) /// 
		title("`figname'",size(*.5) color(black) margin(r+0 b-.5 t+5) ) /// margin(r+10 to move titles (r,l,b, t) to make room
		scale(.9) graphregion(color(white) margin(small)) ///
		legend (position(6) margin(tiny) bmargin(l+5 t+2)) ///			Position (o'clock... You can use this and "ring" setting to put the legend in empty cell...
		/// legend (ring(4)) ///									    Continued from above r.e. leg. in empty cell.... needs the bmargin settings adjusted to work well.
		legend(cols(2)) ///  											Rows(1) to put all of the legend labels on a horizontal line; cols(1) vert 
		legend(size(*.8) symysize(*.8) symxsize(*.6) keygap(vsmall) ) ///	Relative sizing to change the text size in the legend; gap bw marker and text
		///legend(label(1 "Sexism score, 0-1")) ///
		graphregion(color(white) margin(zero)) 
		graph save "RadicalGov.gph", replace	
		
****************************** FIGURE 2 ********************************************************
firthlogit PassAnyResDummy13 c.RRPVS##ib1.LRScore3 logForBornPercent MigRateLag i.ICCIStartType if Year >= 1975, nolog or //
	margins , at(RRPVS=(0(5)30)) atmeans post expression(invlogit(predict(xb)))
	est store Figure2ResMargins1
firthlogit PassAnyLibDummy13 c.RLPVS##ib3.LRScore3 logForBornPercent MigRateLag i.ICCIStartType if Year >= 1975, nolog or //
	margins , at(RLPVS=(0(5)35)) atmeans post expression(invlogit(predict(xb)))
	est store Figure2LibMargins2
coefplot 	(Figure2ResMargins1, label( "ENRP") ///
					color(gs14) barwidth(0.25) bargap(1.5) ) ///
			(Figure2LibMargins2, label( "ENLP") ///
					color(gs8) barwidth(0.25) bargap(1.5)  ) ///
			, ///  
			vertical  ///  
			recast(bar) ///
			plotregion(margin(b=0)) /// Puts the bars right on x axis rather than having any space
			lcolor(black) /// bars will have blackoutline 
			citop barwidth(0.3) fcolor(*.5) /// add conf ints and put them ontop of the bars  
			ciopts(lwidth(*1) lcolor(black)  ) ///
			ylabel(,noticks) ///
		yscale(range(0 .8)) ///
		ylabel(0(.2).8) ///
		ylabel(, grid glwidth(vthin) glcolor(gs10) glpattern(shortdash)) /// Look of the grid
		ylabel(, labsize(small)) ///
		ytitle("Probability of Liberalization (ENLP) or Restriction (ENRP)", size(small)) ///
		///xscale(range(1 4.5)) ///xlabel( ) ///
		/// xlabel(, grid glwidth(vthin) glcolor(gs12) glpattern(shortdash)) /// 
		/// xline(.1882935  , lwidth(vthin) lcolor(gs5)) /// Add line for typical respond at mean marg effects
		/// xline (.4344295  , lwidth(vthin) lcolor(gs8)) /// Add line for typical respond at mean marg effects
		/// xtitle("") b1title ("Sexism Score, 0-1", size(small)) ///
		/// 
		xlabel( 1 `"1"'  2 `"1.5"' 3 `"2"' 4 `"2.5"' 5 `"3"' 6 `"3.5"' 7 `"4"' 8 `"4.5"') /// Label the 11 estimates created with each model above
		xlabel(, labsize(*.55)) /// 
		title("`figname'",size(*.5) color(black) margin(r+0 b-.5 t+5) ) /// margin(r+10 to move titles (r,l,b, t) to make room
		scale(.9) graphregion(color(white) margin(small)) ///
		legend (position(6) margin(tiny) bmargin(l+5 t+2)) ///			Position (o'clock... You can use this and "ring" setting to put the legend in empty cell...
		/// legend (ring(4)) ///									    Continued from above r.e. leg. in empty cell.... needs the bmargin settings adjusted to work well.
		legend(cols(2)) ///  											Rows(1) to put all of the legend labels on a horizontal line; cols(1) vert 
		legend(size(*.8) symysize(*.8) symxsize(*.6) keygap(vsmall) ) ///	Relative sizing to change the text size in the legend; gap bw marker and text
		///legend(label(1 "Sexism score, 0-1")) ///
		graphregion(color(white) margin(zero)) 
		graph save "RadicalGov.gph", replace		
		


firthlogit PassAnyResDummy13 i.RRGov logForBornPercent MigRateLag i.ICCIStartType if Year >= 1975, nolog or //
	margins , at(RRGov =(0 1) ) atmeans post expression(invlogit(predict(xb)))
	est store Figure2ResMargins1
firthlogit PassAnyLibDummy13 i.RLGov logForBornPercent MigRateLag i.ICCIStartType if Year >= 1975, nolog or //
	margins , at(RLGov =(0 1) ) atmeans post expression(invlogit(predict(xb)))
	est store Figure2LibMargins2
	coefplot ///				 
			(Figure2ResMargins1, msym(S) label("ENRP")) ///	Estimates (reordered into a more logical order for results)
			(Figure2LibMargins2, msym(O) label("ENLP") offset(-.1)) ///		(c) "Offsets" distribute markers so they aren't stacked
			, vertical ///
			///
			mcolor(black) msize(medsmall) /// 		marker characteristics that apply to all of markers
			///
			///
			legend (position(6) margin(tiny) bmargin(l+5 t+2)) ///			Position (o'clock and ring = 0 here to put legend in empty cell...
			/// legend (ring(4)) ///											Needs the bmargin settings adjusted to work well.
			legend(rows(2)) ///  											Rows(1) to put all of the legend labels on a horizontal line; cols(1) vert 
			legend(size(*.85) symysize(*.8) symxsize(*.6) keygap(vsmall) ) ///	Relative sizing to change the text size in the legend; gap bw marker and text
			///
			///
			///at recast(line) ///
			ciopts( ///							Color & width of the CI bands around the estimates 
				lcolor(black) /// 
				lwidth(vthin) ///
				recast(rcap) ///
				) ///
			///
			///ciopts(recast(rline) lpattern(dash))
			ytitle("Probability of Liberalization" , size(*.7) margin (l+.5 ) ) /// Margin moves the label out from the axis 
			yscale(range(0(.2)1)) ylabel(0(.2)1) ///
			ylabel(,labsize(*.6)) /// Size of the labels on the y-axis 
			ylabel(, grid glwidth(vthin) glcolor(gs10) glpattern(shortdash)) /// Look of the grid
			///
			/// xtitle("") b1title ("`figname'" , size(small)) /// using b1title puts stops the x-title from encroaching on x-axis
		/// Notice: Use "`figname'" so that first loop through grabs first "local figname" above to rotate axis names depending on dv 
			///xscale(range(.5 3.5)) /// Add a little space--.5 units here--at the front and end of the x-axis  
			xlabel(,labsize(*.55)) /// Size of the labels on the x-axis 			
			/// xlabel(, alternate) /// Angle of the labels on the x-axis 	
			/// xlabel(, angle(315)) /// Angle of the labels on the x-axis 	
			/// 
			xlabel( 1 `"ENLP = 1"'  2 `"ENLP = 1.5"' 3 `"ENLP = 2"' 4 `"ENLP = 2.5"' 5 `"ENLP = 3"' 6 `"ENLP = 3.5"') /// Label the 11 estimates created with each model above
			///
			title("Marginal Effect of ENRP on Restriction, By Government Orientation",size(*.5) color(black) margin(r+0 b-.5 t+5) ) /// margin(r+10 to move titles (r,l,b, t) to make room
			scale(.9) graphregion(color(white) margin(small)) // scale graphy ; White background instead of Stata blue; margins to create space between figures 
			graph display, xsize(2.5) ysize(2.5) // Change these to increase/decrease figure dimensions
			graph save "Figure1Libs1.gph", replace	

qui firthlogit PassAnyResDummy13 c.ENRP##ib2.LRScore3 logForBornPercent MigRateLag i.ICCIStartType if Year >= 1975, nolog or //
	margins , at(ENRP=(1(.5)4.5) LRScore3=(3) ) atmeans post expression(invlogit(predict(xb)))
	est store Figure1ResMargins1
qui firthlogit PassAnyResDummy13 c.ENRP##ib2.LRScore3 logForBornPercent MigRateLag i.ICCIStartType if Year >= 1975, nolog or //
	margins , at(ENRP=(1(.5)4.5) LRScore3=(2) ) atmeans post expression(invlogit(predict(xb)))
	est store Figure1ResMargins2
qui firthlogit PassAnyResDummy13 c.ENRP##ib2.LRScore3 logForBornPercent MigRateLag i.ICCIStartType if Year >= 1975, nolog or //
	margins , at(ENRP=(1(.5)4.5) LRScore3=(1) ) atmeans post expression(invlogit(predict(xb)))
	est store Figure1ResMargins3
	coefplot ///				 
			(Figure1ResMargins1, msym(S) label("Right Governments")) ///	Estimates (reordered into a more logical order for results)
			(Figure1ResMargins2, msym(O) label("Centrist Governments") offset(-.1)) ///		(c) "Offsets" distribute markers so they aren't stacked
			(Figure1ResMargins3, msym(T) label("Left Governments") offset(+.1)) ///		(c) "Offsets" distribute markers so they aren't stacked
			, vertical ///
			///
			mcolor(black) msize(medsmall) /// 		marker characteristics that apply to all of markers
			///
			///
			legend (position(6) margin(tiny) bmargin(l+5 t+2)) ///			Position (o'clock and ring = 0 here to put legend in empty cell...
			/// legend (ring(4)) ///											Needs the bmargin settings adjusted to work well.
			legend(rows(2)) ///  											Rows(1) to put all of the legend labels on a horizontal line; cols(1) vert 
			legend(size(*.85) symysize(*.8) symxsize(*.6) keygap(vsmall) ) ///	Relative sizing to change the text size in the legend; gap bw marker and text
			///
			///
			///at recast(line) ///
			ciopts( ///							Color & width of the CI bands around the estimates 
				lcolor(black) /// 
				lwidth(vthin) ///
				recast(rcap) ///
				) ///
			///
			///ciopts(recast(rline) lpattern(dash))
			ytitle("Probability of Restriction" , size(*.7) margin (l+.5 ) ) /// Margin moves the label out from the axis 
			yscale(range(0(.2)1)) ylabel(0(.2)1) ///
			ylabel(,labsize(*.6)) /// Size of the labels on the y-axis 
			ylabel(, grid glwidth(vthin) glcolor(gs10) glpattern(shortdash)) /// Look of the grid
			///
			/// xtitle("") b1title ("`figname'" , size(small)) /// using b1title puts stops the x-title from encroaching on x-axis
		/// Notice: Use "`figname'" so that first loop through grabs first "local figname" above to rotate axis names depending on dv 
			///xscale(range(.5 5.0)) /// Add a little space--.5 units here--at the front and end of the x-axis  
			xlabel(,labsize(*.55)) /// Size of the labels on the x-axis 			
			/// xlabel(, alternate) /// Angle of the labels on the x-axis 	
			/// xlabel(, angle(315)) /// Angle of the labels on the x-axis 	
			/// 
			xlabel( 1 `"ENRP = 1"'  2 `"ENRP = 1.5"' 3 `"ENRP = 2"' 4 `"ENRP = 2.5"' 5 `"ENRP = 3"' 6 `"ENRP = 3.5"' 7 `"ENRP = 4"' 8 `"ENRP = 4.5"') /// Label the 11 estimates created with each model above
			///
			title("Marginal Effect of ENRP on Restriction, By Government Orientation",size(*.5) color(black) margin(r+0 b-.5 t+5) ) /// margin(r+10 to move titles (r,l,b, t) to make room
			scale(.9) graphregion(color(white) margin(small)) // scale graphy ; White background instead of Stata blue; margins to create space between figures 
			graph display, xsize(2.5) ysize(2.5) // Change these to increase/decrease figure dimensions
			graph save "Figure1Res1.gph", replace	
			
		/* Now combine graphs */
			graph combine /// This is a legend ado that creates one legend when graphs are combined
			 "Figure1Lib1.gph" /// VERIFY THAT THESE MATCH "local varnames" 
			 "Figure1Res1.gph" ///	
			, ///
			/// title(,size(medlarge)) ///
				graphregion(color(white) margin(zero)) 
				graph display, xsize(8) ysize(6.25) // grc1leg won't allow xsize option, but this works	
			///	capture drop  _est*	
		graph export ".\Figure1.tif", width(1500) replace
